emotionweb 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. emotionweb-0.1.0/PKG-INFO +0 -0
  2. emotionweb-0.1.0/README.md +0 -0
  3. emotionweb-0.1.0/emotionweb/__init__.py +1 -0
  4. emotionweb-0.1.0/emotionweb/generator.py +77 -0
  5. emotionweb-0.1.0/emotionweb/themes.py +0 -0
  6. emotionweb-0.1.0/emotionweb.egg-info/PKG-INFO +0 -0
  7. emotionweb-0.1.0/emotionweb.egg-info/SOURCES.txt +57 -0
  8. emotionweb-0.1.0/emotionweb.egg-info/dependency_links.txt +1 -0
  9. emotionweb-0.1.0/emotionweb.egg-info/requires.txt +1 -0
  10. emotionweb-0.1.0/emotionweb.egg-info/top_level.txt +2 -0
  11. emotionweb-0.1.0/setup.cfg +4 -0
  12. emotionweb-0.1.0/setup.py +35 -0
  13. emotionweb-0.1.0/webengine/__init__.py +0 -0
  14. emotionweb-0.1.0/webengine/core/__init__.py +0 -0
  15. emotionweb-0.1.0/webengine/core/asgi.py +16 -0
  16. emotionweb-0.1.0/webengine/core/settings.py +128 -0
  17. emotionweb-0.1.0/webengine/core/urls.py +14 -0
  18. emotionweb-0.1.0/webengine/core/wsgi.py +16 -0
  19. emotionweb-0.1.0/webengine/manage.py +22 -0
  20. emotionweb-0.1.0/webengine/static/gifs/gif1.gif +0 -0
  21. emotionweb-0.1.0/webengine/static/gifs/gif2.gif +0 -0
  22. emotionweb-0.1.0/webengine/static/gifs/gif3.gif +0 -0
  23. emotionweb-0.1.0/webengine/static/gifs/gif4.gif +0 -0
  24. emotionweb-0.1.0/webengine/static/gifs/gif5.gif +0 -0
  25. emotionweb-0.1.0/webengine/static/gifs/gitf6.gif +0 -0
  26. emotionweb-0.1.0/webengine/static/gifs/kiss.jpg.mp4 +0 -0
  27. emotionweb-0.1.0/webengine/static/gifs/pleasese.jpg.mp4 +0 -0
  28. emotionweb-0.1.0/webengine/static/uploads/img1.jpeg +0 -0
  29. emotionweb-0.1.0/webengine/static/uploads/img1.jpg +0 -0
  30. emotionweb-0.1.0/webengine/static/uploads/img2.jpeg +0 -0
  31. emotionweb-0.1.0/webengine/static/uploads/img2.jpg +0 -0
  32. emotionweb-0.1.0/webengine/static/uploads/img3.jpeg +0 -0
  33. emotionweb-0.1.0/webengine/static/uploads/img3.jpg +0 -0
  34. emotionweb-0.1.0/webengine/static/uploads/img4.jpeg +0 -0
  35. emotionweb-0.1.0/webengine/static/uploads/img4.jpg +0 -0
  36. emotionweb-0.1.0/webengine/static/uploads/img5.jpeg +0 -0
  37. emotionweb-0.1.0/webengine/static/uploads/img5.jpg +0 -0
  38. emotionweb-0.1.0/webengine/static/uploads/img6.jpeg +0 -0
  39. emotionweb-0.1.0/webengine/static/uploads/img6.jpg +0 -0
  40. emotionweb-0.1.0/webengine/static/uploads/img7.jpeg +0 -0
  41. emotionweb-0.1.0/webengine/static/uploads/img7.jpg +0 -0
  42. emotionweb-0.1.0/webengine/static/uploads/img8.jpeg +0 -0
  43. emotionweb-0.1.0/webengine/static/uploads/img8.jpg +0 -0
  44. emotionweb-0.1.0/webengine/surprise/__init__.py +0 -0
  45. emotionweb-0.1.0/webengine/surprise/admin.py +3 -0
  46. emotionweb-0.1.0/webengine/surprise/apps.py +6 -0
  47. emotionweb-0.1.0/webengine/surprise/migrations/__init__.py +0 -0
  48. emotionweb-0.1.0/webengine/surprise/models.py +3 -0
  49. emotionweb-0.1.0/webengine/surprise/tests.py +3 -0
  50. emotionweb-0.1.0/webengine/surprise/urls.py +6 -0
  51. emotionweb-0.1.0/webengine/surprise/views.py +116 -0
  52. emotionweb-0.1.0/webengine/templates/anniversary.html +886 -0
  53. emotionweb-0.1.0/webengine/templates/birthday.html +1005 -0
  54. emotionweb-0.1.0/webengine/templates/farewell.html +1 -0
  55. emotionweb-0.1.0/webengine/templates/index.html +11 -0
  56. emotionweb-0.1.0/webengine/templates/love.html +571 -0
  57. emotionweb-0.1.0/webengine/templates/loveletter.html +605 -0
  58. emotionweb-0.1.0/webengine/templates/sorry.html +513 -0
  59. emotionweb-0.1.0/webengine/templates/teachers_day.html +1 -0
Binary file
Binary file
@@ -0,0 +1 @@
1
+ from .generator import Surprise
@@ -0,0 +1,77 @@
1
+ import json
2
+ import webbrowser
3
+ import shutil
4
+ import os
5
+
6
+ class Surprise:
7
+
8
+ def __init__(
9
+ self,
10
+ type,
11
+ name,
12
+ message,
13
+ images,
14
+ caption,
15
+ ):
16
+ self.type = type
17
+ self.name = name
18
+ self.message = message
19
+ self.images = images
20
+ self.caption= caption
21
+
22
+ def generate(self):
23
+
24
+ upload_folder = (
25
+ "webengine/static/uploads"
26
+ )
27
+
28
+ os.makedirs(
29
+ upload_folder,
30
+ exist_ok=True
31
+ )
32
+
33
+ copied = []
34
+
35
+ for i,image in enumerate(self.images):
36
+
37
+ ext = image.split(".")[-1]
38
+
39
+ new_name = f"img{i+1}.{ext}"
40
+
41
+ shutil.copy(
42
+ image,
43
+ f"{upload_folder}/{new_name}"
44
+ )
45
+
46
+ copied.append(
47
+ new_name
48
+ )
49
+
50
+ data = {
51
+ "type": self.type,
52
+ "name":self.name,
53
+
54
+ "message":self.message,
55
+
56
+ "images":copied,
57
+ "caption":self.caption,
58
+ }
59
+
60
+ with open(
61
+ "data.json",
62
+ "w"
63
+ ) as file:
64
+
65
+ json.dump(
66
+ data,
67
+ file,
68
+ indent=4
69
+ )
70
+
71
+ webbrowser.open(
72
+ "http://127.0.0.1:2039"
73
+ )
74
+
75
+ print(
76
+ "Website generated successfully!"
77
+ )
File without changes
@@ -0,0 +1,57 @@
1
+ README.md
2
+ setup.py
3
+ emotionweb/__init__.py
4
+ emotionweb/generator.py
5
+ emotionweb/themes.py
6
+ emotionweb.egg-info/PKG-INFO
7
+ emotionweb.egg-info/SOURCES.txt
8
+ emotionweb.egg-info/dependency_links.txt
9
+ emotionweb.egg-info/requires.txt
10
+ emotionweb.egg-info/top_level.txt
11
+ webengine/__init__.py
12
+ webengine/manage.py
13
+ webengine/core/__init__.py
14
+ webengine/core/asgi.py
15
+ webengine/core/settings.py
16
+ webengine/core/urls.py
17
+ webengine/core/wsgi.py
18
+ webengine/static/gifs/gif1.gif
19
+ webengine/static/gifs/gif2.gif
20
+ webengine/static/gifs/gif3.gif
21
+ webengine/static/gifs/gif4.gif
22
+ webengine/static/gifs/gif5.gif
23
+ webengine/static/gifs/gitf6.gif
24
+ webengine/static/gifs/kiss.jpg.mp4
25
+ webengine/static/gifs/pleasese.jpg.mp4
26
+ webengine/static/uploads/img1.jpeg
27
+ webengine/static/uploads/img1.jpg
28
+ webengine/static/uploads/img2.jpeg
29
+ webengine/static/uploads/img2.jpg
30
+ webengine/static/uploads/img3.jpeg
31
+ webengine/static/uploads/img3.jpg
32
+ webengine/static/uploads/img4.jpeg
33
+ webengine/static/uploads/img4.jpg
34
+ webengine/static/uploads/img5.jpeg
35
+ webengine/static/uploads/img5.jpg
36
+ webengine/static/uploads/img6.jpeg
37
+ webengine/static/uploads/img6.jpg
38
+ webengine/static/uploads/img7.jpeg
39
+ webengine/static/uploads/img7.jpg
40
+ webengine/static/uploads/img8.jpeg
41
+ webengine/static/uploads/img8.jpg
42
+ webengine/surprise/__init__.py
43
+ webengine/surprise/admin.py
44
+ webengine/surprise/apps.py
45
+ webengine/surprise/models.py
46
+ webengine/surprise/tests.py
47
+ webengine/surprise/urls.py
48
+ webengine/surprise/views.py
49
+ webengine/surprise/migrations/__init__.py
50
+ webengine/templates/anniversary.html
51
+ webengine/templates/birthday.html
52
+ webengine/templates/farewell.html
53
+ webengine/templates/index.html
54
+ webengine/templates/love.html
55
+ webengine/templates/loveletter.html
56
+ webengine/templates/sorry.html
57
+ webengine/templates/teachers_day.html
@@ -0,0 +1 @@
1
+ Django>=4.2
@@ -0,0 +1,2 @@
1
+ emotionweb
2
+ webengine
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,35 @@
1
+ from pathlib import Path
2
+ from setuptools import setup, find_packages
3
+
4
+
5
+ BASE_DIR = Path(__file__).parent
6
+ README = (BASE_DIR / "README.md").read_text(encoding="utf-8")
7
+
8
+
9
+ setup(
10
+ name="emotionweb",
11
+ version="0.1.0",
12
+
13
+ description="Generate personalized surprise websites using Python and Django.",
14
+
15
+ long_description=README,
16
+ long_description_content_type="text/markdown",
17
+
18
+ author="Aniket Vishwakarma",
19
+ author_email="aniketvishwa39@gmail.com",
20
+
21
+ packages=find_packages(),
22
+
23
+ install_requires=[
24
+ "Django>=4.2",
25
+ ],
26
+
27
+ package_data={
28
+ "webengine": [
29
+ "templates/*.html",
30
+ "static/**/*",
31
+ ],
32
+ },
33
+
34
+ include_package_data=True,
35
+ )
File without changes
File without changes
@@ -0,0 +1,16 @@
1
+ """
2
+ ASGI config for core project.
3
+
4
+ It exposes the ASGI callable as a module-level variable named ``application``.
5
+
6
+ For more information on this file, see
7
+ https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
8
+ """
9
+
10
+ import os
11
+
12
+ from django.core.asgi import get_asgi_application
13
+
14
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
15
+
16
+ application = get_asgi_application()
@@ -0,0 +1,128 @@
1
+ """
2
+ Django settings for core project.
3
+
4
+ Generated by 'django-admin startproject' using Django 4.2.30.
5
+
6
+ For more information on this file, see
7
+ https://docs.djangoproject.com/en/4.2/topics/settings/
8
+
9
+ For the full list of settings and their values, see
10
+ https://docs.djangoproject.com/en/4.2/ref/settings/
11
+ """
12
+
13
+ from pathlib import Path
14
+
15
+ # Build paths inside the project like this: BASE_DIR / 'subdir'.
16
+ BASE_DIR = Path(__file__).resolve().parent.parent
17
+
18
+
19
+ # Quick-start development settings - unsuitable for production
20
+ # See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
21
+
22
+ # SECURITY WARNING: keep the secret key used in production secret!
23
+ SECRET_KEY = 'django-insecure-u0egx&c12l#i!ny4p_y#(h34u*s=xx@vn6zj*z%4^jn24($-7l'
24
+
25
+ # SECURITY WARNING: don't run with debug turned on in production!
26
+ DEBUG = True
27
+
28
+ ALLOWED_HOSTS = []
29
+
30
+
31
+ # Application definition
32
+
33
+ INSTALLED_APPS = [
34
+ 'django.contrib.admin',
35
+ 'django.contrib.auth',
36
+ 'django.contrib.contenttypes',
37
+ 'django.contrib.sessions',
38
+ 'django.contrib.messages',
39
+ 'django.contrib.staticfiles',
40
+ 'surprise',
41
+ ]
42
+
43
+ MIDDLEWARE = [
44
+ 'django.middleware.security.SecurityMiddleware',
45
+ 'django.contrib.sessions.middleware.SessionMiddleware',
46
+ 'django.middleware.common.CommonMiddleware',
47
+ 'django.middleware.csrf.CsrfViewMiddleware',
48
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
49
+ 'django.contrib.messages.middleware.MessageMiddleware',
50
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
51
+ ]
52
+
53
+ ROOT_URLCONF = 'core.urls'
54
+
55
+ TEMPLATES = [
56
+ {
57
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
58
+ 'DIRS': [BASE_DIR / "templates"],
59
+ 'APP_DIRS': True,
60
+ 'OPTIONS': {
61
+ 'context_processors': [
62
+ 'django.template.context_processors.debug',
63
+ 'django.template.context_processors.request',
64
+ 'django.contrib.auth.context_processors.auth',
65
+ 'django.contrib.messages.context_processors.messages',
66
+ ],
67
+ },
68
+ },
69
+ ]
70
+
71
+ WSGI_APPLICATION = 'core.wsgi.application'
72
+
73
+
74
+ # Database
75
+ # https://docs.djangoproject.com/en/4.2/ref/settings/#databases
76
+
77
+ DATABASES = {
78
+ 'default': {
79
+ 'ENGINE': 'django.db.backends.sqlite3',
80
+ 'NAME': BASE_DIR / 'db.sqlite3',
81
+ }
82
+ }
83
+
84
+
85
+ # Password validation
86
+ # https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
87
+
88
+ AUTH_PASSWORD_VALIDATORS = [
89
+ {
90
+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
91
+ },
92
+ {
93
+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
94
+ },
95
+ {
96
+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
97
+ },
98
+ {
99
+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
100
+ },
101
+ ]
102
+
103
+
104
+ # Internationalization
105
+ # https://docs.djangoproject.com/en/4.2/topics/i18n/
106
+
107
+ LANGUAGE_CODE = 'en-us'
108
+
109
+ TIME_ZONE = 'UTC'
110
+
111
+ USE_I18N = True
112
+
113
+ USE_TZ = True
114
+
115
+
116
+ # Static files (CSS, JavaScript, Images)
117
+ # https://docs.djangoproject.com/en/4.2/howto/static-files/
118
+
119
+ # Default primary key field type
120
+ # https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
121
+
122
+ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
123
+
124
+ STATIC_URL = "/static/"
125
+
126
+ STATICFILES_DIRS = [
127
+ BASE_DIR / "static",
128
+ ]
@@ -0,0 +1,14 @@
1
+ from django.contrib import admin
2
+ from django.urls import path, include
3
+ from django.conf import settings
4
+ from django.conf.urls.static import static
5
+
6
+ urlpatterns = [
7
+ path("admin/", admin.site.urls),
8
+ path("", include("surprise.urls")),
9
+ ]
10
+
11
+ urlpatterns += static(
12
+ settings.STATIC_URL,
13
+ document_root=settings.STATICFILES_DIRS[0]
14
+ )
@@ -0,0 +1,16 @@
1
+ """
2
+ WSGI config for core project.
3
+
4
+ It exposes the WSGI callable as a module-level variable named ``application``.
5
+
6
+ For more information on this file, see
7
+ https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
8
+ """
9
+
10
+ import os
11
+
12
+ from django.core.wsgi import get_wsgi_application
13
+
14
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
15
+
16
+ application = get_wsgi_application()
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env python3
2
+ """Django's command-line utility for administrative tasks."""
3
+ import os
4
+ import sys
5
+
6
+
7
+ def main():
8
+ """Run administrative tasks."""
9
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
10
+ try:
11
+ from django.core.management import execute_from_command_line
12
+ except ImportError as exc:
13
+ raise ImportError(
14
+ "Couldn't import Django. Are you sure it's installed and "
15
+ "available on your PYTHONPATH environment variable? Did you "
16
+ "forget to activate a virtual environment?"
17
+ ) from exc
18
+ execute_from_command_line(sys.argv)
19
+
20
+
21
+ if __name__ == '__main__':
22
+ main()
File without changes
@@ -0,0 +1,3 @@
1
+ from django.contrib import admin
2
+
3
+ # Register your models here.
@@ -0,0 +1,6 @@
1
+ from django.apps import AppConfig
2
+
3
+
4
+ class SurpriseConfig(AppConfig):
5
+ default_auto_field = 'django.db.models.BigAutoField'
6
+ name = 'surprise'
@@ -0,0 +1,3 @@
1
+ from django.db import models
2
+
3
+ # Create your models here.
@@ -0,0 +1,3 @@
1
+ from django.test import TestCase
2
+
3
+ # Create your tests here.
@@ -0,0 +1,6 @@
1
+ from django.urls import path
2
+ from . import views
3
+
4
+ urlpatterns = [
5
+ path("", views.surprise, name="surprise"),
6
+ ]
@@ -0,0 +1,116 @@
1
+ import json
2
+ from django.shortcuts import render
3
+
4
+ def surprise(request):
5
+
6
+ with open("../data.json", "r") as file:
7
+
8
+ data = json.load(file)
9
+
10
+ if data.get("type") == "love":
11
+
12
+ return render(
13
+
14
+ request,
15
+
16
+ "love.html",
17
+
18
+ {
19
+
20
+ "name": data["name"],
21
+
22
+ "message": data["message"],
23
+
24
+ "images": data["images"],
25
+
26
+ "caption": data["caption"]
27
+
28
+ }
29
+
30
+ )
31
+
32
+ elif data.get("type") == "birthday":
33
+
34
+ return render(
35
+
36
+ request,
37
+
38
+ "birthday.html",
39
+
40
+ {
41
+
42
+ "name": data["name"],
43
+
44
+ "message": data["message"],
45
+
46
+ "images": data["images"],
47
+
48
+ "caption": data["caption"]
49
+
50
+ }
51
+
52
+ )
53
+ elif data["type"] == "anniversary":
54
+
55
+ return render(
56
+
57
+ request,
58
+
59
+ "anniversary.html",
60
+
61
+ {
62
+
63
+ "name": data["name"],
64
+
65
+ "message": data["message"],
66
+
67
+ "images": data["images"],
68
+
69
+ "caption": data["caption"]
70
+
71
+ }
72
+ )
73
+ elif data["type"] == "loveletter":
74
+
75
+ return render(
76
+ request,
77
+ "loveletter.html",
78
+ {
79
+ "name": data["name"],
80
+
81
+ "message": data["message"],
82
+
83
+ "images": data["images"],
84
+ }
85
+ )
86
+ elif data["type"] == "apology":
87
+
88
+ return render(
89
+
90
+ request,
91
+
92
+ "sorry.html",
93
+
94
+
95
+ )
96
+ else:
97
+
98
+ return render(
99
+
100
+ request,
101
+
102
+ "love.html",
103
+
104
+ {
105
+
106
+ "name": data["name"],
107
+
108
+ "message": data["message"],
109
+
110
+ "images": data["images"],
111
+
112
+ "caption": data["caption"]
113
+
114
+ }
115
+
116
+ )