Related
I am trying to deploy my own django app on google cloud.
I'm following this documentation
by Google Cloud to deploy the app.
I have changed the settings.py file of my app according to the settings.py file of settings.py file of the sample app provided by google and I think this issue is due to some mistake in that setting file or maybe something else. I'm not able to solve the error after lots of attempts.
please help me thank you
Settings.py file
from pathlib import Path
import os
import io
from urllib.parse import urlparse
import environ
from google.cloud import secretmanager
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# [START gaestd_py_django_secret_config]
env = environ.Env(DEBUG=(bool, False))
env_file = os.path.join(BASE_DIR, ".env")
if os.path.isfile(env_file):
# Use a local secret file, if provided
env.read_env(env_file)
# [START_EXCLUDE]
elif os.getenv("TRAMPOLINE_CI", None):
# Create local settings if running with CI, for unit testing
placeholder = (
f"SECRET_KEY=a\n"
f"DATABASE_URL=sqlite://{os.path.join(BASE_DIR, 'db.sqlite3')}"
)
env.read_env(io.StringIO(placeholder))
# [END_EXCLUDE]
elif os.environ.get("GOOGLE_CLOUD_PROJECT", None):
# Pull secrets from Secret Manager
project_id = os.environ.get("GOOGLE_CLOUD_PROJECT")
client = secretmanager.SecretManagerServiceClient()
settings_name = os.environ.get("SETTINGS_NAME", "django_settings")
name = f"projects/{project_id}/secrets/{settings_name}/versions/latest"
payload = client.access_secret_version(name=name).payload.data.decode("UTF-8")
env.read_env(io.StringIO(payload))
else:
raise Exception("No local .env or GOOGLE_CLOUD_PROJECT detected. No secrets found.")
# [END gaestd_py_django_secret_config]
SECRET_KEY = env("SECRET_KEY")
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env("DEBUG")
# [START gaestd_py_django_csrf]
# SECURITY WARNING: It's recommended that you use this when
# running in production. The URL will be known once you first deploy
# to App Engine. This code takes the URL and converts it to both these settings formats.
APPENGINE_URL = env("APPENGINE_URL", default=None)
if APPENGINE_URL:
# Ensure a scheme is present in the URL before it's processed.
if not urlparse(APPENGINE_URL).scheme:
APPENGINE_URL = f"https://{APPENGINE_URL}"
ALLOWED_HOSTS = [urlparse(APPENGINE_URL).netloc]
CSRF_TRUSTED_ORIGINS = [APPENGINE_URL]
SECURE_SSL_REDIRECT = True
else:
ALLOWED_HOSTS = ["*"]
# [END gaestd_py_django_csrf]
# Application definition
INSTALLED_APPS = [
'portpolio.apps.PortpolioConfig',
'CRblogs.apps.CrblogsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_social_share',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'crrathod.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'crrathod.wsgi.application'
# Database
# [START db_setup]
# [START gaestd_py_django_database_config]
# Use django-environ to parse the connection string
DATABASES = {"default": env.db()}
# If the flag as been set, configure to use proxy
if os.getenv("USE_CLOUD_SQL_AUTH_PROXY", None):
DATABASES["default"]["HOST"] = "127.0.0.1"
DATABASES["default"]["PORT"] = 8088
# [END gaestd_py_django_database_config]
# [END db_setup]
# Use a in-memory sqlite3 database when testing in CI systems
# TODO(glasnt) CHECK IF THIS IS REQUIRED because we're setting a val above
if os.getenv("TRAMPOLINE_CI", None):
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
}
}
# Password validation
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/4.0/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/
# STATICFILES_DIRS =[
# os.path.join(BASE_DIR, 'static')
# ]
# STATIC_ROOT = os.path.join(BASE_DIR,'assets')
STATIC_URL = 'static/'
MEDIA_URL = '/media/'
if DEBUG:
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
else:
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MEDIA_ROOT = os.path.join(BASE_DIR,'media')
# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
Log file
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\google\api_core\grpc_helpers.py", line 72, in error_remapped_callable
return callable_(*args, **kwargs)
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\grpc\_channel.py", line 946, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\grpc\_channel.py", line 849, in _end_unary_response_blocking
raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.PERMISSION_DENIED
details = "Permission denied on resource project my-portfolio-361305."
debug_error_string = "{"created":"#1662731782.139000000","description":"Error received from peer ipv6:[2404:6800:4009:825::200a]:443","file":"src/core/lib/surface/call.cc","file_line":967,"grpc_message":"Permission denied on resource project my-portfolio-361305.","grpc_status":7}"
>
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
utility.execute()
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\django\core\management\__init__.py", line 386, in execute
settings.INSTALLED_APPS
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\django\conf\__init__.py", line 87, in __getattr__
self._setup(name)
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\django\conf\__init__.py", line 74, in _setup
self._wrapped = Settings(settings_module)
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\django\conf\__init__.py", line 183, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\LONAR\AppData\Local\Programs\Python\Python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\crrathod\settings.py", line 50, in <module>
payload = client.access_secret_version(name=name).payload.data.decode("UTF-8")
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\google\cloud\secretmanager_v1\services\secret_manager_service\client.py", line 1440, in access_secret_version
response = rpc(
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\google\api_core\gapic_v1\method.py", line 154, in __call__
return wrapped_func(*args, **kwargs)
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\google\api_core\retry.py", line 283, in retry_wrapped_func
return retry_target(
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\google\api_core\retry.py", line 190, in retry_target
return target()
File "C:\Program Files (x86)\Google\Cloud SDK\Portfolio-blog\env\lib\site-packages\google\api_core\grpc_helpers.py", line 74, in error_remapped_callable
raise exceptions.from_grpc_error(exc) from exc
google.api_core.exceptions.PermissionDenied: 403 Permission denied on resource project my-portfolio-361305. [links {
description: "Google developer console API key"
url: "https://console.developers.google.com/project/ my-portfolio-361305/apiui/credential"
}
, reason: "CONSUMER_INVALID"
domain: "googleapis.com"
metadata {
key: "service"
value: "secretmanager.googleapis.com"
}
metadata {
key: "consumer"
value: "projects/ my-portfolio-361305"
}
]
I just shifted from one problem to another. I did some changes here. I have removed space after = from this cmd set GOOGLE_CLOUD_PROJECT=my-portfolio-361305 previously I was using set GOOGLE_CLOUD_PROJECT= my-portfolio-361305 this cmd. Now I have also removed space after = in secret manager file as I read that in some solutions for my new problem Error in deploying Django app on Google cloud using appengine "django.core.exceptions.ImproperlyConfigured: Set the SECRET_KEY environment variable".
I got a solution to that problem as well by running set SECRET_KEY=my_secret_key_value
But now got a new problem as after running python manage.py makemigrations
as
RuntimeWarning: Got an error checking a consistent migration history performed for >database connection 'default': connection to server at "127.0.0.1", port 5432>failed: FATAL: password authentication failed for user "CRRathod"
warnings.warn(
No changes detected
It seems here as I have entered the wrong password. But I check that as well
Thank You!
When I'm using SECRET_KEY value in settings.py, the Django application is working fine but as soon as I put the value in .env file and stating SECRET_KEY = config('SECRET_KEY') in settings.py, it is giving padding error.
The First case in which I put SECRET_KEY value directly in settings.py is working fine.
Second case using .env file giving padding error. Below is the code for the second case.
"""
Django settings for swadeshikart project.
Generated by 'django-admin startproject' using Django 3.1.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from pathlib import Path
from decouple import config
import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = config('SECRET_KEY')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = config('DEBUG', default=True, cast=bool) # True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'category',
'accounts',
'store',
'carts',
'mathfilters',
'orders',
'django_generate_secret_key',
'admin_honeypot',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django_session_timeout.middleware.SessionTimeoutMiddleware',
]
SESSION_EXPIRE_SECONDS = 3600 # 1 hr
SESSION_EXPIRE_AFTER_LAST_ACTIVITY = True
ROOT_URLCONF = 'swadeshikart.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'category.context_processors.menu_links',
'carts.context_processors.cart_total',
],
},
},
]
WSGI_APPLICATION = 'swadeshikart.wsgi.application'
AUTH_USER_MODEL='accounts.Account'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR /'static'
STATICFILES_DIRS = [
'swadeshikart/static',
]
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR /'media'
from django.contrib.messages import constants as messages
MESSAGE_TAGS = {
messages.ERROR: 'danger',
}
# SMTP configuration
EMAIL_HOST = config('EMAIL_HOST')
EMAIL_PORT = config('EMAIL_PORT', cast=int)
EMAIL_HOST_USER = config('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD')
EMAIL_USE_TLS = config('EMAIL_USE_TLS', cast=bool)
SECRET_KEY==m-ddx5p+*hx12n)o1f#g&7lb)10n%50c70$(f3g80-r+8pq73
DEBUG=True
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_HOST_USER=#
EMAIL_HOST_PASSWORD=#
EMAIL_USE_TLS=True
Error at /
Incorrect padding
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 3.1
Exception Type: Error
Exception Value:
Incorrect padding
Exception Location: /home/rd/anaconda3/lib/python3.7/base64.py, line 87, in b64decode
Python Executable: /home/rd/Documents/New_Projects/SwadeshiKart/kart/bin/python
Python Version: 3.7.6
Python Path:
['/home/rd/Documents/New_Projects/SwadeshiKart',
'/home/rd/anaconda3/lib/python37.zip',
'/home/rd/anaconda3/lib/python3.7',
'/home/rd/anaconda3/lib/python3.7/lib-dynload',
'/home/rd/Documents/New_Projects/SwadeshiKart/kart/lib/python3.7/site-packages']
Server time: Wed, 26 May 2021 01:48:21 +0000
Traceback Switch to copy-and-paste view
/home/rd/Documents/New_Projects/SwadeshiKart/kart/lib/python3.7/site-packages/django/contrib/sessions/backends/base.py, line 215, in _get_session
return self._session_cache …
▶ Local vars
During handling of the above exception ('SessionStore' object has no attribute '_session_cache'), another exception occurred:
/home/rd/Documents/New_Projects/SwadeshiKart/kart/lib/python3.7/site-packages/django/contrib/sessions/backends/base.py, line 118, in decode
return signing.loads(session_data, salt=self.key_salt, serializer=self.serializer) …
▶ Local vars
/home/rd/Documents/New_Projects/SwadeshiKart/kart/lib/python3.7/site-packages/django/core/signing.py, line 135, in loads
base64d = TimestampSigner(key, salt=salt).unsign(s, max_age=max_age).encode() …
▶ Local vars
/home/rd/Documents/New_Projects/SwadeshiKart/kart/lib/python3.7/site-packages/django/core/signing.py, line 201, in unsign
result = super().unsign(value) …
▶ Local vars
/home/rd/Documents/New_Projects/SwadeshiKart/kart/lib/python3.7/site-packages/django/core/signing.py, line 184, in unsign
raise BadSignature('Signature "%s" does not match' % sig) …
▶ Local vars
During handling of the above exception (Signature "k1EFM899XEbldYeSg6kXKkmWENfoSCNnmlP1WUmbmwI" does not match), another exception occurred:
/home/rd/Documents/New_Projects/SwadeshiKart/kart/lib/python3.7/site-packages/django/core/handlers/exception.py, line 47, in inner
response = get_response(request) …
▶ Local vars
/home/rd/Documents/New_Projects/SwadeshiKart/kart/lib/python3.7/site-packages/django/utils/deprecation.py, line 113, in __call__
response = self.process_request(request) …
▶ Local vars
/home/rd/Documents/New_Projects/SwadeshiKart/kart/lib/python3.7/site-packages/django_session_timeout/middleware.py, line 21, in process_request
init_time = request.session.setdefault(SESSION_TIMEOUT_KEY, time.time()) …
▶ Local vars
/home/rd/Documents/New_Projects/SwadeshiKart/kart/lib/python3.7/site-packages/django/contrib/sessions/backends/base.py, line 88, in setdefault
if key in self._session: …
▶ Local vars
/home/rd/Documents/New_Projects/SwadeshiKart/kart/lib/python3.7/site-packages/django/contrib/sessions/backends/base.py, line 220, in _get_session
self._session_cache = self.load() …
▶ Local vars
/home/rd/Documents/New_Projects/SwadeshiKart/kart/lib/python3.7/site-packages/django/contrib/sessions/backends/db.py, line 44, in load
return self.decode(s.session_data) if s else {} …
▶ Local vars
/home/rd/Documents/New_Projects/SwadeshiKart/kart/lib/python3.7/site-packages/django/contrib/sessions/backends/base.py, line 122, in decode
return self._legacy_decode(session_data) …
▶ Local vars
/home/rd/Documents/New_Projects/SwadeshiKart/kart/lib/python3.7/site-packages/django/contrib/sessions/backends/base.py, line 126, in _legacy_decode
encoded_data = base64.b64decode(session_data.encode('ascii')) …
▶ Local vars
/home/rd/anaconda3/lib/python3.7/base64.py, line 87, in b64decode
return binascii.a2b_base64(s) …
▶ Local vars
Request information
USER
[unable to retrieve the current user]
GET
No GET data
POST
No POST data
FILES
No FILES data
COOKIES
Variable Value
csrftoken
'kNTfdyJGDhD7eUuDWbQqxCn32H6F152mfTDmfTntseXmJ2IRyWfZ0Hsu0Yf0S1Bs'
sessionid
'x9mgcdqhis7wcbv2c4cf8ms45nynkgro'
META
Variable Value
ANDROID_SDK_ROOT
'/home/rd/Android/Sdk'
AWS_ACCESS_KEY_ID
'********************'
AWS_SECRET_ACCESS_KEY
'********************'
AWS_STORAGE_BUCKET_NAME
'django-blog-files-rdx'
COLORTERM
'truecolor'
CONDA_BACKUP_ADDR2LINE
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-addr2line'
CONDA_BACKUP_AR
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-ar'
CONDA_BACKUP_AS
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-as'
CONDA_BACKUP_CC
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cc'
CONDA_BACKUP_CFLAGS
('-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong '
'-fno-plt -O2 -ffunction-sections -pipe -isystem /home/rd/anaconda3/include')
CONDA_BACKUP_CMAKE_PREFIX_PATH
'/home/rd/anaconda3:/home/rd/anaconda3/x86_64-conda_cos6-linux-gnu/sysroot/usr'
CONDA_BACKUP_CONDA_BUILD_SYSROOT
'/home/rd/anaconda3/x86_64-conda_cos6-linux-gnu/sysroot'
CONDA_BACKUP_CPP
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cpp'
CONDA_BACKUP_CPPFLAGS
'-DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/rd/anaconda3/include'
CONDA_BACKUP_CXX
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-c++'
CONDA_BACKUP_CXXFILT
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-c++filt'
CONDA_BACKUP_CXXFLAGS
('-fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona '
'-mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 '
'-ffunction-sections -pipe -isystem /home/rd/anaconda3/include')
CONDA_BACKUP_DEBUG_CFLAGS
('-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-all '
'-fno-plt -Og -g -Wall -Wextra -fvar-tracking-assignments -ffunction-sections '
'-pipe -isystem /home/rd/anaconda3/include')
CONDA_BACKUP_DEBUG_CPPFLAGS
'-D_DEBUG -D_FORTIFY_SOURCE=2 -Og -isystem /home/rd/anaconda3/include'
CONDA_BACKUP_DEBUG_CXXFLAGS
('-fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona '
'-mtune=haswell -ftree-vectorize -fPIC -fstack-protector-all -fno-plt -Og -g '
'-Wall -Wextra -fvar-tracking-assignments -ffunction-sections -pipe -isystem '
'/home/rd/anaconda3/include')
CONDA_BACKUP_ELFEDIT
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-elfedit'
CONDA_BACKUP_GCC
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-gcc'
CONDA_BACKUP_GCC_AR
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-gcc-ar'
CONDA_BACKUP_GCC_NM
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-gcc-nm'
CONDA_BACKUP_GCC_RANLIB
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-gcc-ranlib'
CONDA_BACKUP_GPROF
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-gprof'
CONDA_BACKUP_GXX
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-g++'
CONDA_BACKUP_HOST
'x86_64-conda_cos6-linux-gnu'
CONDA_BACKUP_LD
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-ld'
CONDA_BACKUP_LDFLAGS
('-Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now '
'-Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/home/rd/anaconda3/lib '
'-Wl,-rpath-link,/home/rd/anaconda3/lib -L/home/rd/anaconda3/lib')
CONDA_BACKUP_LD_GOLD
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-ld.gold'
CONDA_BACKUP_NM
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-nm'
CONDA_BACKUP_OBJCOPY
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-objcopy'
CONDA_BACKUP_OBJDUMP
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-objdump'
CONDA_BACKUP_RANLIB
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-ranlib'
CONDA_BACKUP_READELF
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-readelf'
CONDA_BACKUP_SIZE
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-size'
CONDA_BACKUP_STRINGS
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-strings'
CONDA_BACKUP_STRIP
'/home/rd/anaconda3/bin/x86_64-conda_cos6-linux-gnu-strip'
CONDA_BACKUP__CONDA_PYTHON_SYSCONFIGDATA_NAME
'_sysconfigdata_x86_64_conda_cos6_linux_gnu'
CONDA_EXE
'/home/rd/anaconda3/bin/conda'
CONDA_PYTHON_EXE
'/home/rd/anaconda3/bin/python'
CONDA_SHLVL
'0'
CONTENT_LENGTH
''
CONTENT_TYPE
'text/plain'
CSRF_COOKIE
'kNTfdyJGDhD7eUuDWbQqxCn32H6F152mfTDmfTntseXmJ2IRyWfZ0Hsu0Yf0S1Bs'
DBUS_SESSION_BUS_ADDRESS
'unix:path=/run/user/1000/bus,guid=de537b9439c3d4958854b83560a1125d'
DBUS_STARTER_ADDRESS
'unix:path=/run/user/1000/bus,guid=de537b9439c3d4958854b83560a1125d'
DBUS_STARTER_BUS_TYPE
'session'
DEBUG_VALUE
'True'
DEFAULTS_PATH
'/usr/share/gconf/ubuntu.default.path'
DESKTOP_SESSION
'ubuntu'
DISPLAY
':1'
DJANGO_SETTINGS_MODULE
'swadeshikart.settings'
EMAIL_PASS
'********************'
EMAIL_USER
'rishabdhyani4#gmail.com'
FLUTTER_STORAGE_BASE_URL
'https://storage.flutter-io.cn'
GATEWAY_INTERFACE
'CGI/1.1'
GDMSESSION
'ubuntu'
GNOME_DESKTOP_SESSION_ID
'this-is-deprecated'
GNOME_SHELL_SESSION_MODE
'ubuntu'
GNOME_TERMINAL_SCREEN
'/org/gnome/Terminal/screen/bccf778d_b127_4117_b15a_2e46273f0f2f'
GNOME_TERMINAL_SERVICE
':1.228'
GPG_AGENT_INFO
'/run/user/1000/gnupg/S.gpg-agent:0:1'
GTK_MODULES
'gail:atk-bridge'
HOME
'/home/rd'
HOST
'x86_64-conda_cos6-linux-gnu'
HTTP_ACCEPT
'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
HTTP_ACCEPT_ENCODING
'gzip, deflate, br'
HTTP_ACCEPT_LANGUAGE
'en-GB,en-US;q=0.9,en;q=0.8,hi;q=0.7'
HTTP_CONNECTION
'keep-alive'
HTTP_COOKIE
('csrftoken=kNTfdyJGDhD7eUuDWbQqxCn32H6F152mfTDmfTntseXmJ2IRyWfZ0Hsu0Yf0S1Bs; '
'sessionid=x9mgcdqhis7wcbv2c4cf8ms45nynkgro')
HTTP_HOST
'127.0.0.1:8000'
HTTP_SEC_CH_UA
'" Not A;Brand";v="99", "Chromium";v="90", "Google Chrome";v="90"'
HTTP_SEC_CH_UA_MOBILE
'?0'
HTTP_SEC_FETCH_DEST
'document'
HTTP_SEC_FETCH_MODE
'navigate'
HTTP_SEC_FETCH_SITE
'none'
HTTP_SEC_FETCH_USER
'?1'
HTTP_UPGRADE_INSECURE_REQUESTS
'1'
HTTP_USER_AGENT
('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/90.0.4430.212 Safari/537.36')
IM_CONFIG_PHASE
'1'
INVOCATION_ID
'e40f587fb6e944e8b9d0cc70bde984bf'
JOURNAL_STREAM
'9:44888'
LANG
'en_IN'
LANGUAGE
'en_IN:en'
LESSCLOSE
'/usr/bin/lesspipe %s %s'
LESSOPEN
'| /usr/bin/lesspipe %s'
LOGNAME
'rd'
LS_COLORS
'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:'
MANAGERPID
'7121'
MANDATORY_PATH
'/usr/share/gconf/ubuntu.mandatory.path'
PATH
'/home/rd/Documents/New_Projects/SwadeshiKart/kart/bin:/home/rd/anaconda3/condabin:/home/rd/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/rd/Android/Sdk/tools:/home/rd/Documents/Development/flutter/bin:/home/rd/.local/bin:/home/rd/Android/Sdk/tools:/home/rd/Documents/Development/flutter/bin:/home/rd/.local/bin'
PATH_INFO
'/'
PS1
('(kart) \\[\\e]0;\\u#\\h: '
'\\w\\a\\]${debian_chroot:+($debian_chroot)}\\[\\033[01;32m\\]\\u#\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ ')
PUB_HOSTED_URL
'https://pub.flutter-io.cn'
PWD
'/home/rd/Documents/New_Projects/SwadeshiKart'
QT_ACCESSIBILITY
'1'
QT_IM_MODULE
'ibus'
QUERY_STRING
''
REMOTE_ADDR
'127.0.0.1'
REMOTE_HOST
''
REQUEST_METHOD
'GET'
RUN_MAIN
'true'
SCRIPT_NAME
''
SECRET_KEY
'********************'
SERVER_NAME
'localhost'
SERVER_PORT
'8000'
SERVER_PROTOCOL
'HTTP/1.1'
SERVER_SOFTWARE
'WSGIServer/0.2'
SESSION_MANAGER
'local/ROG-Strix:#/tmp/.ICE-unix/7524,unix/ROG-Strix:/tmp/.ICE-unix/7524'
SHELL
'/bin/bash'
SHLVL
'1'
SSH_AGENT_PID
'7485'
SSH_AUTH_SOCK
'/run/user/1000/keyring/ssh'
TERM
'xterm-256color'
TZ
'UTC'
USER
'rd'
USERNAME
'rd'
VIRTUAL_ENV
'/home/rd/Documents/New_Projects/SwadeshiKart/kart'
VTE_VERSION
'6003'
WINDOWPATH
'2'
XAUTHORITY
'/run/user/1000/gdm/Xauthority'
XDG_CONFIG_DIRS
'/etc/xdg/xdg-ubuntu:/etc/xdg'
XDG_CURRENT_DESKTOP
'ubuntu:GNOME'
XDG_DATA_DIRS
'/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop'
XDG_MENU_PREFIX
'gnome-'
XDG_RUNTIME_DIR
'/run/user/1000'
XDG_SESSION_CLASS
'user'
XDG_SESSION_DESKTOP
'ubuntu'
XDG_SESSION_TYPE
'x11'
XMODIFIERS
'#im=ibus'
_
'/home/rd/Documents/New_Projects/SwadeshiKart/kart/bin/python'
_CE_CONDA
''
_CE_M
''
wsgi.errors
<_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'>
wsgi.file_wrapper
<class 'wsgiref.util.FileWrapper'>
wsgi.input
<django.core.handlers.wsgi.LimitedStream object at 0x7f042b9de650>
wsgi.multiprocess
False
wsgi.multithread
True
wsgi.run_once
False
wsgi.url_scheme
'http'
wsgi.version
(1, 0)
Settings
Using settings module swadeshikart.settings
Setting Value
ABSOLUTE_URL_OVERRIDES
{}
ADMINS
[]
ALLOWED_HOSTS
[]
APPEND_SLASH
True
AUTHENTICATION_BACKENDS
['django.contrib.auth.backends.ModelBackend']
AUTH_PASSWORD_VALIDATORS
'********************'
AUTH_USER_MODEL
'accounts.Account'
BASE_DIR
PosixPath('/home/rd/Documents/New_Projects/SwadeshiKart')
CACHES
{'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
CACHE_MIDDLEWARE_ALIAS
'default'
CACHE_MIDDLEWARE_KEY_PREFIX
'********************'
CACHE_MIDDLEWARE_SECONDS
600
CSRF_COOKIE_AGE
31449600
CSRF_COOKIE_DOMAIN
None
CSRF_COOKIE_HTTPONLY
False
CSRF_COOKIE_NAME
'csrftoken'
CSRF_COOKIE_PATH
'/'
CSRF_COOKIE_SAMESITE
'Lax'
CSRF_COOKIE_SECURE
False
CSRF_FAILURE_VIEW
'django.views.csrf.csrf_failure'
CSRF_HEADER_NAME
'HTTP_X_CSRFTOKEN'
CSRF_TRUSTED_ORIGINS
[]
CSRF_USE_SESSIONS
False
DATABASES
{'default': {'ATOMIC_REQUESTS': False,
'AUTOCOMMIT': True,
'CONN_MAX_AGE': 0,
'ENGINE': 'django.db.backends.sqlite3',
'HOST': '',
'NAME': PosixPath('/home/rd/Documents/New_Projects/SwadeshiKart/db.sqlite3'),
'OPTIONS': {},
'PASSWORD': '********************',
'PORT': '',
'TEST': {'CHARSET': None,
'COLLATION': None,
'MIGRATE': True,
'MIRROR': None,
'NAME': None},
'TIME_ZONE': None,
'USER': ''}}
DATABASE_ROUTERS
[]
DATA_UPLOAD_MAX_MEMORY_SIZE
2621440
DATA_UPLOAD_MAX_NUMBER_FIELDS
1000
DATETIME_FORMAT
'N j, Y, P'
DATETIME_INPUT_FORMATS
['%Y-%m-%d %H:%M:%S',
'%Y-%m-%d %H:%M:%S.%f',
'%Y-%m-%d %H:%M',
'%m/%d/%Y %H:%M:%S',
'%m/%d/%Y %H:%M:%S.%f',
'%m/%d/%Y %H:%M',
'%m/%d/%y %H:%M:%S',
'%m/%d/%y %H:%M:%S.%f',
'%m/%d/%y %H:%M']
DATE_FORMAT
'N j, Y'
DATE_INPUT_FORMATS
['%Y-%m-%d',
'%m/%d/%Y',
'%m/%d/%y',
'%b %d %Y',
'%b %d, %Y',
'%d %b %Y',
'%d %b, %Y',
'%B %d %Y',
'%B %d, %Y',
'%d %B %Y',
'%d %B, %Y']
DEBUG
True
DEBUG_PROPAGATE_EXCEPTIONS
False
DECIMAL_SEPARATOR
'.'
DEFAULT_CHARSET
'utf-8'
DEFAULT_EXCEPTION_REPORTER
'django.views.debug.ExceptionReporter'
DEFAULT_EXCEPTION_REPORTER_FILTER
'django.views.debug.SafeExceptionReporterFilter'
DEFAULT_FILE_STORAGE
'django.core.files.storage.FileSystemStorage'
DEFAULT_FROM_EMAIL
'webmaster#localhost'
DEFAULT_HASHING_ALGORITHM
'sha256'
DEFAULT_INDEX_TABLESPACE
''
DEFAULT_TABLESPACE
''
DISALLOWED_USER_AGENTS
[]
EMAIL_BACKEND
'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST
'smtp.gmail.com'
EMAIL_HOST_PASSWORD
'********************'
EMAIL_HOST_USER
'rishabhdhyani4#gmail.com'
EMAIL_PORT
587
EMAIL_SSL_CERTFILE
None
EMAIL_SSL_KEYFILE
'********************'
EMAIL_SUBJECT_PREFIX
'[Django] '
EMAIL_TIMEOUT
None
EMAIL_USE_LOCALTIME
False
EMAIL_USE_SSL
False
EMAIL_USE_TLS
True
FILE_UPLOAD_DIRECTORY_PERMISSIONS
None
FILE_UPLOAD_HANDLERS
['django.core.files.uploadhandler.MemoryFileUploadHandler',
'django.core.files.uploadhandler.TemporaryFileUploadHandler']
FILE_UPLOAD_MAX_MEMORY_SIZE
2621440
FILE_UPLOAD_PERMISSIONS
420
FILE_UPLOAD_TEMP_DIR
None
FIRST_DAY_OF_WEEK
0
FIXTURE_DIRS
[]
FORCE_SCRIPT_NAME
None
FORMAT_MODULE_PATH
None
FORM_RENDERER
'django.forms.renderers.DjangoTemplates'
IGNORABLE_404_URLS
[]
INSTALLED_APPS
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'category',
'accounts',
'store',
'carts',
'mathfilters',
'orders',
'django_generate_secret_key',
'admin_honeypot']
INTERNAL_IPS
[]
LANGUAGES
[('af', 'Afrikaans'),
('ar', 'Arabic'),
('ar-dz', 'Algerian Arabic'),
('ast', 'Asturian'),
('az', 'Azerbaijani'),
('bg', 'Bulgarian'),
('be', 'Belarusian'),
('bn', 'Bengali'),
('br', 'Breton'),
('bs', 'Bosnian'),
('ca', 'Catalan'),
('cs', 'Czech'),
('cy', 'Welsh'),
('da', 'Danish'),
('de', 'German'),
('dsb', 'Lower Sorbian'),
('el', 'Greek'),
('en', 'English'),
('en-au', 'Australian English'),
('en-gb', 'British English'),
('eo', 'Esperanto'),
('es', 'Spanish'),
('es-ar', 'Argentinian Spanish'),
('es-co', 'Colombian Spanish'),
('es-mx', 'Mexican Spanish'),
('es-ni', 'Nicaraguan Spanish'),
('es-ve', 'Venezuelan Spanish'),
('et', 'Estonian'),
('eu', 'Basque'),
('fa', 'Persian'),
('fi', 'Finnish'),
('fr', 'French'),
('fy', 'Frisian'),
('ga', 'Irish'),
('gd', 'Scottish Gaelic'),
('gl', 'Galician'),
('he', 'Hebrew'),
('hi', 'Hindi'),
('hr', 'Croatian'),
('hsb', 'Upper Sorbian'),
('hu', 'Hungarian'),
('hy', 'Armenian'),
('ia', 'Interlingua'),
('id', 'Indonesian'),
('ig', 'Igbo'),
('io', 'Ido'),
('is', 'Icelandic'),
('it', 'Italian'),
('ja', 'Japanese'),
('ka', 'Georgian'),
('kab', 'Kabyle'),
('kk', 'Kazakh'),
('km', 'Khmer'),
('kn', 'Kannada'),
('ko', 'Korean'),
('ky', 'Kyrgyz'),
('lb', 'Luxembourgish'),
('lt', 'Lithuanian'),
('lv', 'Latvian'),
('mk', 'Macedonian'),
('ml', 'Malayalam'),
('mn', 'Mongolian'),
('mr', 'Marathi'),
('my', 'Burmese'),
('nb', 'Norwegian Bokmål'),
('ne', 'Nepali'),
('nl', 'Dutch'),
('nn', 'Norwegian Nynorsk'),
('os', 'Ossetic'),
('pa', 'Punjabi'),
('pl', 'Polish'),
('pt', 'Portuguese'),
('pt-br', 'Brazilian Portuguese'),
('ro', 'Romanian'),
('ru', 'Russian'),
('sk', 'Slovak'),
('sl', 'Slovenian'),
('sq', 'Albanian'),
('sr', 'Serbian'),
('sr-latn', 'Serbian Latin'),
('sv', 'Swedish'),
('sw', 'Swahili'),
('ta', 'Tamil'),
('te', 'Telugu'),
('tg', 'Tajik'),
('th', 'Thai'),
('tk', 'Turkmen'),
('tr', 'Turkish'),
('tt', 'Tatar'),
('udm', 'Udmurt'),
('uk', 'Ukrainian'),
('ur', 'Urdu'),
('uz', 'Uzbek'),
('vi', 'Vietnamese'),
('zh-hans', 'Simplified Chinese'),
('zh-hant', 'Traditional Chinese')]
LANGUAGES_BIDI
['he', 'ar', 'ar-dz', 'fa', 'ur']
LANGUAGE_CODE
'en-us'
LANGUAGE_COOKIE_AGE
None
LANGUAGE_COOKIE_DOMAIN
None
LANGUAGE_COOKIE_HTTPONLY
False
LANGUAGE_COOKIE_NAME
'django_language'
LANGUAGE_COOKIE_PATH
'/'
LANGUAGE_COOKIE_SAMESITE
None
LANGUAGE_COOKIE_SECURE
False
LOCALE_PATHS
[]
LOGGING
{}
LOGGING_CONFIG
'logging.config.dictConfig'
LOGIN_REDIRECT_URL
'/accounts/profile/'
LOGIN_URL
'/accounts/login/'
LOGOUT_REDIRECT_URL
None
MANAGERS
[]
MEDIA_ROOT
PosixPath('/home/rd/Documents/New_Projects/SwadeshiKart/media')
MEDIA_URL
'/media/'
MESSAGE_STORAGE
'django.contrib.messages.storage.fallback.FallbackStorage'
MESSAGE_TAGS
{40: 'danger'}
MIDDLEWARE
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django_session_timeout.middleware.SessionTimeoutMiddleware']
MIGRATION_MODULES
{}
MONTH_DAY_FORMAT
'F j'
NUMBER_GROUPING
0
PASSWORD_HASHERS
'********************'
PASSWORD_RESET_TIMEOUT
'********************'
PASSWORD_RESET_TIMEOUT_DAYS
'********************'
PREPEND_WWW
False
ROOT_URLCONF
'swadeshikart.urls'
SECRET_KEY
'********************'
SECURE_BROWSER_XSS_FILTER
False
SECURE_CONTENT_TYPE_NOSNIFF
True
SECURE_HSTS_INCLUDE_SUBDOMAINS
False
SECURE_HSTS_PRELOAD
False
SECURE_HSTS_SECONDS
0
SECURE_PROXY_SSL_HEADER
None
SECURE_REDIRECT_EXEMPT
[]
SECURE_REFERRER_POLICY
'same-origin'
SECURE_SSL_HOST
None
SECURE_SSL_REDIRECT
False
SERVER_EMAIL
'root#localhost'
SESSION_CACHE_ALIAS
'default'
SESSION_COOKIE_AGE
1209600
SESSION_COOKIE_DOMAIN
None
SESSION_COOKIE_HTTPONLY
True
SESSION_COOKIE_NAME
'sessionid'
SESSION_COOKIE_PATH
'/'
SESSION_COOKIE_SAMESITE
'Lax'
SESSION_COOKIE_SECURE
False
SESSION_ENGINE
'django.contrib.sessions.backends.db'
SESSION_EXPIRE_AFTER_LAST_ACTIVITY
True
SESSION_EXPIRE_AT_BROWSER_CLOSE
False
SESSION_EXPIRE_SECONDS
3600
SESSION_FILE_PATH
None
SESSION_SAVE_EVERY_REQUEST
False
SESSION_SERIALIZER
'django.contrib.sessions.serializers.JSONSerializer'
SETTINGS_MODULE
'swadeshikart.settings'
SHORT_DATETIME_FORMAT
'm/d/Y P'
SHORT_DATE_FORMAT
'm/d/Y'
SIGNING_BACKEND
'django.core.signing.TimestampSigner'
SILENCED_SYSTEM_CHECKS
[]
STATICFILES_DIRS
['swadeshikart/static']
STATICFILES_FINDERS
['django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder']
STATICFILES_STORAGE
'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_ROOT
PosixPath('/home/rd/Documents/New_Projects/SwadeshiKart/static')
STATIC_URL
'/static/'
TEMPLATES
[{'APP_DIRS': True,
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['templates'],
'OPTIONS': {'context_processors': ['django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'category.context_processors.menu_links',
'carts.context_processors.cart_total']}}]
TEST_NON_SERIALIZED_APPS
[]
TEST_RUNNER
'django.test.runner.DiscoverRunner'
THOUSAND_SEPARATOR
','
TIME_FORMAT
'P'
TIME_INPUT_FORMATS
['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
TIME_ZONE
'UTC'
USE_I18N
True
USE_L10N
True
USE_THOUSAND_SEPARATOR
False
USE_TZ
True
USE_X_FORWARDED_HOST
False
USE_X_FORWARDED_PORT
False
WSGI_APPLICATION
'swadeshikart.wsgi.application'
X_FRAME_OPTIONS
'DENY'
YEAR_MONTH_FORMAT
'F Y'
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard page generated by the handler for this status code.
Please help me out.
this is my first question at Stack overflow. I have been learning Python for about a month and Django for two weeks. I tried to run a second server on my MacBook Pro and then had these problems.(the error messages from my terminal below) The second server included some other applications including Pihole. I deleted the second server files and re-booted, problem solved! The next thing was that I tried editing my Views.py file in Django and then the same error message came back when I re-booted my Django server in the virtual environment folder.
See errors below:
mymac#michaels-MacBook-Pro mfdw_root % python manage.py runserver
Traceback (most recent call last):
File "/Users/mymac/Desktop/mfdw_project/mfdw_root/manage.py", line 22, in <module>
main()
File "/Users/mymac/Desktop/mfdw_project/mfdw_root/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/__init__.py", line 345, in execute
settings.INSTALLED_APPS
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/conf/__init__.py", line 83, in __getattr__
self._setup(name)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/conf/__init__.py", line 70, in _setup
self._wrapped = Settings(settings_module)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/conf/__init__.py", line 177, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 786, in exec_module
File "<frozen importlib._bootstrap_external>", line 923, in get_code
File "<frozen importlib._bootstrap_external>", line 853, in source_to_code
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/Users/mymac/Desktop/mfdw_project/mfdw_root/mfdw_site/settings.py", line 123
'DIRS': [BASE_DIR / 'mfdw_site/templates'],
^
SyntaxError: illegal target for annotation
end of errors********
This is my first question at Stack Overflow and I am very uncertain right now if I will ever get my server running again on my MacBook Pro with Python 3.9.0 and Django 3.1.3
This is the error I get above, and I can't connect to 127.0.0.1 , the localhost on my MacBook Pro.
Please try and give me a clue as to how to proceed. I have been following the lessons of djangobook.com .
Below is my settings.py file:
"""
Django settings for mfdw_site project.
Generated by 'django-admin startproject' using Django 3.1.3.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '# secret key goes here, it is present in actual code'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'pages.apps.PagesConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'mfdw_site.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR / 'mfdw_site/templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'mfdw_site.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
'DIRS': [BASE_DIR / 'mfdw_site/templates'],
STATICFILES_DIRS = [BASE_DIR / 'mfdw_site/static')]
Also, is there a path problem with my Django installation? I am running on a MacBook Pro which is properly updated to use Python 3.9 . I think it might have something to do with this part of the errors:
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
Does this seem reasonable? The flagged code in settings.py occurs on line 123.
Also it looks to me like python 3.9 has an included django installation which is confused via path with the mfdw_project files.
Am I right and what should I do about it?
Please read the error carefully, it says that your settings file is misconfigured on line 123 and gives you the line that is offending with the ^ as a sign on where it happens:
'DIRS': [BASE_DIR / 'mfdw_site/templates'],
^
and it says there is a syntax error, so you can tell that the problem is you wrote something not according to the syntax of python.
According to this, you should check what is going on on the line before this line (line 122), check what happens if you put this line in comment (with #), it will either find another error on the next line, find an error somewhere later or run smoothly.
If it finds an error on the next line, you can check what you did wrong on the line before this one (line 122).
If it finds an error somewhere later on you can understand the problem is with the actual line (line 122) and it's probably the / you have there, a list sepperator is comma (,), not /...
Edit:
First, thanks for adding the settings file, it helps to find the error after we know what to look for.
The offending line is 123 and it looks like this:
'DIRS': [BASE_DIR / 'mfdw_site/templates'],
This has 3 problems:
The 'DIRS' shouldn't be a string, it should be a variable, so remove the '.
The line shouldn't have a colon, this is not a dictionary or a function definition.
I understand that you want to have the path as BASE_DIR/mfdw_site/templates, assuming so, it can be [f'{BASE_DIR}/mfdw_site/templates'] and a few other options, but this is the easiest
my django app is not being able to send email. On my email less secure apps is turned on and i have unlocked captcha. am stuck i dont know what am missing. any help will be appreciated.
Traceback
Environment:
Request Method: POST
Request URL: http://localhost:8000/
Django Version: 3.0.9
Python Version: 3.8.3
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'shield_sec']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/apple/projects/Django/ingabo_sec/shield_sec/views.py", line 17, in contact
send_mail (
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/core/mail/__init__.py", line 60, in send_mail
return mail.send()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/core/mail/message.py", line 284, in send
return self.get_connection(fail_silently).send_messages([self])
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/core/mail/backends/smtp.py", line 102, in send_messages
new_conn_created = self.open()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django/core/mail/backends/smtp.py", line 69, in open
self.connection.login(self.username, self.password)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/smtplib.py", line 734, in login
raise last_exception
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/smtplib.py", line 723, in login
(code, resp) = self.auth(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/smtplib.py", line 646, in auth
raise SMTPAuthenticationError(code, resp)
Exception Type: SMTPAuthenticationError at /
Exception Value: (535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials l188sm1732224lfd.127 - gsmtp')
settings.py
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]
# Email settings
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = '*******#gmail.com'
EMAIL_HOST_PASSWORD = '********'
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
#EMAIL_USE_SSL = True
views.py
from django.shortcuts import render
from django.http import HttpResponseRedirect ,Http404
from django.core.mail import send_mail
from django.conf import settings
from . forms import ContacForm
# Create your views here.
def contact (request):
if request.method == "POST":
sender_name = request.POST.get('sender-name',False)
sender_number = request.POST.get('sender-number',False)
sender_email = request.POST.get('sender-email',False)
sender_subject = request.POST.get('sender-subject',False)
message = request.POST.get('message',False)
send_mail (
sender_name,
sender_number,
sender_email,
['***********#gmail.com'],
sender_subject,
message,
)
return render (request,'shield_sec/contact.html', {'sender_name': sender_name})
else:
return render (request,'shield_sec/contact.html', {})
I suspecting probably there problem might lie in my settings.py but everything looks fine.
I've been hung up on deploying my React/Django app to GAE for the last two days and I think I've isolated the issue, but I've been unable to come up with a solution that works. When I first deployed I was running into issues with mimetypes with each of my JS and CSS files embedded in my index.html being blocked with error messages like these leading me to believe it found the files but didn't handle them correctly:
(file) was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
My understanding from browsing SO and doing research was that GAE was treating these as html files and not executing them properly. I started playing with the .yaml to enforce mime types due to some settings I saw in the references for GAE and now I can't deploy and get error message:
ERROR: (gcloud.app.deploy) An error occurred while parsing file: [(mysite)\app.yaml]
Unknown url handler type.
<URLMap
static_files=None
upload=None
application_readable=None
static_dir=None
mime_type=text/css
expiration=None
require_matching_file=None
http_headers=None
position=None
api_endpoint=None
redirect_http_response_code=None
url=/static/css\.css
login=optional
auth_fail_action=redirect
secure=default
script=None
>
in "(mysite)/app.yaml", line 8, column 1
I've been playing around with the files in the browser and I've found that I get 404 errors when I try to pull up the files despite knowing that they're in the directory. IE navigating here: https://acptconstruction.appspot.com/backend/static/js/2.738f0ca9.chunk.js yields a 404, but I can see it with the exact filename in the directory. Because of that and the error message on deployment, I think that maybe GAE is having trouble parsing the filenames because of all of the periods? The filenames were built when I ran npm run-scripts build after I was finished with the front end app, but regardless, I tried to deploy copying that file to homepage.js and including using that exact filename with the path without success.
I don't know if I was on a better track with the first yaml file, where it could "find" them (I think) and not grock them or with the second yaml where they couldn't be found? The issue might be as simple as copying all the js files and changing their names to like homepage.js and homepage2.js but I am nervous that I might break everything if I go down that path. Any help is appreciated!
Files:
Originally, my app.yaml file looked like this:
runtime: python38
handlers:
- url: /static
static_dir: static/
- url: /.*
script: auto
Updated YAML that gives the deployment errors:
runtime: python38
handlers:
- url: /static/css/(.*)
mime_type: text/css
- url: /static/js/(.*)
mime_type: text/javascript
index.html:
<!doctype html><html lang="en" style="background-color:#f1f1f1"><head><base href="/"> <meta charset="utf-8"/><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="ACPT Construction"/><link rel="manifest" href="/manifest.json"/><title>ACPT Construction</title><link type="text/css" href="/backend/static/css/2.89e89512.chunk.css" rel="stylesheet"><link type="text/css" href="/backend/static/css/main.cfd2a7ed.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root" style="min-height:1000px"></div><script>!function(e){function t(t){for(var n,c,i=t[0],l=t[1],a=t[2],f=0,s=[];f<i.length;f++)c=i[f],Object.prototype.hasOwnProperty.call(o,c)&&o[c]&&s.push(o[c][0]),o[c]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(p&&p(t);s.length;)s.shift()();return u.push.apply(u,a||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,i=1;i<r.length;i++){var l=r[i];0!==o[l]&&(n=!1)}n&&(u.splice(t--,1),e=c(c.s=r[0]))}return e}var n={},o={1:0},u=[];function c(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,c),r.l=!0,r.exports}c.m=e,c.c=n,c.d=function(e,t,r){c.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},c.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.t=function(e,t){if(1&t&&(e=c(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(c.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)c.d(r,n,function(t){return e[t]}.bind(null,n));return r},c.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(t,"a",t),t},c.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},c.p="/";var i=this.webpackJsonpacptconstruction=this.webpackJsonpacptconstruction||[],l=i.push.bind(i);i.push=t,i=i.slice();for(var a=0;a<i.length;a++)t(i[a]);var p=l;r()}([])</script><script type="application/javascript" src="/backend/static/js/2.738f0ca9.chunk.js"></script><script type="application/javascript" src="/backend/static/js/main.b160e3e4.chunk.js"></script></body></html>
File structure:
acptconstruction
backend
settings.py
manage.py (command to run server is python manage.py runserver)
backend
views.py (heres where index.html gets called)
urls.py (url structure)
acptconstruction (front end)
build
index.html
manifest.json
app.yaml
static
css
js
media
settings.py:
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
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/1.11/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY =
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'emailcontactform',
'corsheaders'
]
MIDDLEWARE = [
'whitenoise.middleware.WhiteNoiseMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'backend.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'acptconstruction')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'backend.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'acptconstruction', 'build', 'static'),
]
if DEBUG:
STATIC_ROOT = os.path.join(BASE_DIR, 'backend','/static')
else:
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_USE_TLS = True
EMAIL_PORT =
EMAIL_HOST_USER =
EMAIL_HOST_PASSWORD =
CORS_ORIGIN_WHITELIST = [
'http://localhost:3000',
'http://localhost:8000',
'http://localhost:8080',
]
https://your_app.appspot.com/backend/static/js/2.738f0ca9.chunk.js does not match any pattern in your app.yaml. Either get rid of the /backend/ part of the url, or add the handler to your app.yaml:
handlers:
- url: /static/css
static_dir: static/css
- url: /backend/static/css
static_dir: static/css
- url: /static/js
static_dir: static/js
- url: /backend/static/js
static_dir: static/js
And the mime_type error you saw was probably due to your tags in the template.html file. The proper tags are:
<link rel="stylesheet" href="styles.css">
or:
<link rel="stylesheet" type="text/css" href="styles.css">
You don't want to put text/html in those tags.