diff --git a/.gitignore b/.gitignore index aa93f3c..81b3020 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /venv/ /db.sqlite3 -/media/ \ No newline at end of file +/media/ +/tea/.env diff --git a/choose/templates/choose.html b/choose/templates/choose.html index a5a62f7..229473f 100644 --- a/choose/templates/choose.html +++ b/choose/templates/choose.html @@ -5,6 +5,8 @@ Title + diff --git a/choose/templates/vote.html b/choose/templates/vote.html new file mode 100644 index 0000000..bea3f7d --- /dev/null +++ b/choose/templates/vote.html @@ -0,0 +1,64 @@ + + + + + Title + + + + + + \ No newline at end of file diff --git a/choose/views.py b/choose/views.py index a6683ca..ef566b2 100644 --- a/choose/views.py +++ b/choose/views.py @@ -47,6 +47,9 @@ def list_of_teas(): return {'categories': dic, 'ms': [0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500]} +def list_of_choices(): + pass + @login_requiered def home(request): diff --git a/tea/settings.py b/tea/settings.py index b8ff5c2..be1dede 100644 --- a/tea/settings.py +++ b/tea/settings.py @@ -9,9 +9,13 @@ https://docs.djangoproject.com/en/4.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/4.1/ref/settings/ """ - +import environ from pathlib import Path +env = environ.Env(DEBUG=(bool, False)) +root = environ.Path(__file__) - 2 +environ.Env.read_env() + # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -20,14 +24,15 @@ BASE_DIR = Path(__file__).resolve().parent.parent # See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'django-insecure-u=yu7(3@719dv(dtgy3wz_%yaw((r9-sh4exp(qf@to8o-e=e@' +SECRET_KEY = env.str('SECRET_KEY', '!!! SET YOUR SECRET_KEY !!!') # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = env.bool('DEBUG', False) ALLOWED_HOSTS = [ '127.0.0.1', - '10.15.0.1' + '10.15.0.1', + 'tea.paov.ru' ] @@ -133,5 +138,12 @@ MEDIA_URL = '/media/' CORS_ORIGIN_WHITELIST = [ 'http://10.15.0.1:8000', 'http://localhost:8000', - 'http://127.0.0.1:9000' + 'http://127.0.0.1:9000', ] +SOCIAL_AUTH_TELEGRAM_BOT_TOKEN = env.str('SOCIAL_AUTH_TELEGRAM_BOT_TOKEN') + + +AUTHENTICATION_BACKENDS = ( + 'social_core.backends.telegram.TelegramAuth', + 'django.contrib.auth.backends.ModelBackend', +) \ No newline at end of file diff --git a/tea/urls.py b/tea/urls.py index d1b1aba..e47a36e 100644 --- a/tea/urls.py +++ b/tea/urls.py @@ -14,7 +14,7 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin -from django.urls import path +from django.urls import path, include from django.conf import settings from django.conf.urls.static import static @@ -22,6 +22,7 @@ import choose.views urlpatterns = [ path('admin/', admin.site.urls), + path('auth/', include('social_django.urls', namespace='social')), path('', choose.views.home), path('confirm-choice', choose.views.confirm_choose), path('login', choose.views.login_view, name='login_view')