sleepytaco 4 anni fa
parent
commit
66e6b4b1ee
4 ha cambiato i file con 21 aggiunte e 38 eliminazioni
  1. 3 0
      .gitignore
  2. 17 32
      UnTube/settings.py
  3. 1 1
      apps/users/views.py
  4. 0 5
      requirements.txt

+ 3 - 0
.gitignore

@@ -12,3 +12,6 @@ __pycache__/
 *.pyc
 /static/
 .env
+/apps/main/migrations/
+/apps/users/migrations/
+

+ 17 - 32
UnTube/settings.py

@@ -11,23 +11,13 @@ https://docs.djangoproject.com/en/3.2/ref/settings/
 """
 import os
 from pathlib import Path
-
-import dj_database_url
-import django_heroku
-import dotenv
-import psycopg2
-
 from UnTube.secrets import SECRETS
 
 # Build paths inside the project like this: BASE_DIR / 'subdir'.
 
-PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
-# BASE_DIR = Path(__file__).resolve().parent.parent
-BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
-
-dotenv_file = os.path.join(BASE_DIR, ".env")
-if os.path.isfile(dotenv_file):
-    dotenv.load_dotenv(dotenv_file)
+# PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
+BASE_DIR = Path(__file__).resolve().parent.parent
+# BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 
 # Quick-start development settings - unsuitable for production
 # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
@@ -61,17 +51,12 @@ INSTALLED_APPS = [
     'crispy_forms',
     'apps.users',  # has stuff related to user management in it (login, signup, show homepage, pass reset)
     'apps.main',  # main app, shows user their homepage
-
-    # added these while setting up heroku
-    'whitenoise.runserver_nostatic',
 ]
 
 CRISPY_TEMPLATE_PACK = 'bootstrap4'
 
 MIDDLEWARE = [
     'django.middleware.security.SecurityMiddleware',
-    'whitenoise.middleware.WhiteNoiseMiddleware',
-
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.middleware.common.CommonMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
@@ -119,7 +104,7 @@ SOCIALACCOUNT_PROVIDERS = {
     }
 }
 
-SITE_ID = 5
+SITE_ID = 3
 
 LOGIN_URL = '/'
 
@@ -130,15 +115,15 @@ WSGI_APPLICATION = 'UnTube.wsgi.application'
 
 # Database
 # https://docs.djangoproject.com/en/3.2/ref/settings/#databases
-#DATABASES = {
-#    'default': {
-#        'ENGINE': 'django.db.backends.sqlite3',
-#        'NAME': BASE_DIR / 'db.sqlite3',
-#    }
-#}
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.sqlite3',
+        'NAME': BASE_DIR / 'db.sqlite3',
+    }
+}
 
-DATABASES = {}
-DATABASES['default'] = dj_database_url.config(conn_max_age=600)
+#DATABASES = {}
+#DATABASES['default'] = dj_database_url.config(conn_max_age=600)
 
 # DATABASE_URL = os.environ['DATABASE_URL']
 # conn = psycopg2.connect(DATABASE_URL, sslmode='require')
@@ -175,13 +160,13 @@ USE_TZ = True
 # Static files (CSS, JavaScript, Images)
 # https://docs.djangoproject.com/en/3.2/howto/static-files/
 STATIC_URL = '/static/'
-STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
-STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
+STATIC_ROOT = os.path.join(BASE_DIR, 'static')
+# STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
 
 # Default primary key field type
 # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
 DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
 
-django_heroku.settings(locals())
-options = DATABASES['default'].get('OPTIONS', {})
-options.pop('sslmode', None)
+# django_heroku.settings(locals())
+# options = DATABASES['default'].get('OPTIONS', {})
+# options.pop('sslmode', None)

+ 1 - 1
apps/users/views.py

@@ -88,7 +88,7 @@ def start_import(request):
         print("User has no playlists on YT")
 
         return HttpResponse(loader.get_template('intercooler/progress_bar.html').render(
-            {"total_playlists": 'IMPORTED 0 PLAYLISTS lol',
+            {"total_playlists": 0,
              "playlists_imported": 0,
              "done": True,
              "progress": 100,

+ 0 - 5
requirements.txt

@@ -5,11 +5,9 @@ cffi==1.14.5
 chardet==4.0.0
 cryptography==3.4.7
 defusedxml==0.7.1
-dj-database-url==0.5.0
 Django==3.2.3
 django-allauth==0.44.0
 django-crispy-forms==1.11.2
-django-heroku==0.3.1
 ecdsa==0.14.1
 google-api-core==1.28.0
 google-api-python-client==2.7.0
@@ -24,14 +22,11 @@ install==1.3.4
 oauthlib==3.1.0
 packaging==20.9
 protobuf==3.17.1
-psycopg2==2.8.6
-psycopg2-binary==2.8.6
 pyasn1==0.4.8
 pyasn1-modules==0.2.8
 pycparser==2.20
 PyJWT==2.1.0
 pyparsing==2.4.7
-python-dotenv==0.17.1
 python-jose==3.2.0
 python3-openid==3.2.0
 pytz==2021.1