-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf9b653
commit e8fbac7
Showing
12 changed files
with
183 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,15 +8,19 @@ | |
|
||
|
||
class Command(BaseCommand): | ||
"""Command to create a superuser if 'admin' does not exist.""" | ||
"""Command to create a superuser if "admin" does not exist.""" | ||
help = "Create a superuser if 'admin' does not exist" | ||
|
||
def handle(self, *args, **options): | ||
user_admin = User.objects.filter(username='newstore') | ||
user_admin = User.objects.filter(username="newstore") | ||
if not user_admin: | ||
user_admin = User.objects.create_superuser( | ||
username = 'newstore', | ||
email = '[email protected]', | ||
first_name = 'new', | ||
last_name = 'store', | ||
password = 'newstoreadmin' | ||
username="newstore", | ||
email="[email protected]", | ||
first_name="new", | ||
last_name="store", | ||
password="newstoreadmin" | ||
) | ||
self.stdout.write( | ||
self.style.SUCCESS("Superuser created successfully.") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,44 +16,44 @@ | |
environ.Env.read_env() | ||
|
||
ENVIRONMENT = env | ||
SECRET_KEY = os.environ.get('SECRET_KEY', default='your secret key') | ||
SECRET_KEY = os.environ.get("SECRET_KEY", default="your secret key") | ||
|
||
|
||
# DEBUG settings: FALSE in production | ||
DEBUG = 'RENDER' not in os.environ | ||
DEBUG = "RENDER" not in os.environ | ||
|
||
|
||
# Host permission settings | ||
ALLOWED_HOSTS = [] | ||
|
||
RENDER_EXTERNAL_HOSTNAME = os.environ.get('RENDER_EXTERNAL_HOSTNAME') | ||
RENDER_EXTERNAL_HOSTNAME = os.environ.get("RENDER_EXTERNAL_HOSTNAME") | ||
if RENDER_EXTERNAL_HOSTNAME: | ||
ALLOWED_HOSTS.append(RENDER_EXTERNAL_HOSTNAME) | ||
|
||
|
||
# Installed Apps categories | ||
DJANGO_APPS = [ | ||
'django.contrib.admin', | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.messages', | ||
'django.contrib.staticfiles', | ||
"django.contrib.admin", | ||
"django.contrib.auth", | ||
"django.contrib.contenttypes", | ||
"django.contrib.sessions", | ||
"django.contrib.messages", | ||
"django.contrib.staticfiles", | ||
] | ||
|
||
CORE_APPS = [ | ||
'users', | ||
'core', | ||
'home', | ||
'products', | ||
'cart', | ||
'management', | ||
'payment', | ||
"users", | ||
"core", | ||
"home", | ||
"products", | ||
"cart", | ||
"management", | ||
"payment", | ||
] | ||
|
||
THIRD_PARTY_APPS = [ | ||
'paypal.standard.ipn', | ||
'import_export', | ||
"paypal.standard.ipn", | ||
"import_export", | ||
] | ||
|
||
INSTALLED_APPS = DJANGO_APPS + CORE_APPS + THIRD_PARTY_APPS | ||
|
@@ -63,89 +63,89 @@ | |
|
||
|
||
# Paypal settings | ||
PAYPAL_RECEIVER_EMAIL = '[email protected]' # Sandbox email | ||
PAYPAL_RECEIVER_EMAIL = "[email protected]" | ||
PAYPAL_TEST = True | ||
PAYPAL_BUY_BUTTON_IMAGE = '/static/img/buttom_paypal.svg' | ||
PAYPAL_BUY_BUTTON_IMAGE = "/static/img/buttom_paypal.svg" | ||
|
||
|
||
# Auth model settings | ||
AUTH_USER_MODEL = 'users.CustomUser' | ||
AUTH_USER_MODEL = "users.CustomUser" | ||
|
||
|
||
# Log setting | ||
LOGIN_URL = '/users/login/' | ||
LOGIN_URL = "/users/login/" | ||
|
||
|
||
# NPM | ||
NPM_BIN_PATH = r"C:\Program Files\nodejs\npm.cmd" | ||
|
||
|
||
AUTHENTICATION_BACKENDS = [ | ||
'django.contrib.auth.backends.ModelBackend', | ||
"django.contrib.auth.backends.ModelBackend", | ||
] | ||
|
||
# Middleware settings | ||
MIDDLEWARE = [ | ||
'django.middleware.security.SecurityMiddleware', | ||
'whitenoise.middleware.WhiteNoiseMiddleware', | ||
'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.middleware.security.SecurityMiddleware", | ||
"whitenoise.middleware.WhiteNoiseMiddleware", | ||
"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 URL settings | ||
ROOT_URLCONF = 'core.urls' | ||
ROOT_URLCONF = "core.urls" | ||
|
||
|
||
# Templates settings | ||
TEMPLATES = [ | ||
{ | ||
'BACKEND': 'django.template.backends.django.DjangoTemplates', | ||
'DIRS': [os.path.join(BASE_DIR, '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', | ||
'utils.context_processors.company', | ||
'utils.context_processors.user_preferences', | ||
'utils.context_processors.products_featured', | ||
'utils.context_processors.products_categories', | ||
'utils.context_processors.cart_items_count', | ||
"BACKEND": "django.template.backends.django.DjangoTemplates", | ||
"DIRS": [os.path.join(BASE_DIR, "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", | ||
"utils.context_processors.company", | ||
"utils.context_processors.user_preferences", | ||
"utils.context_processors.products_featured", | ||
"utils.context_processors.products_categories", | ||
"utils.context_processors.cart_items_count", | ||
], | ||
}, | ||
}, | ||
] | ||
|
||
# WSGI entry point | ||
WSGI_APPLICATION = 'core.wsgi.application' | ||
WSGI_APPLICATION = "core.wsgi.application" | ||
|
||
|
||
# Database settings | ||
if 'test' in sys.argv: | ||
if "test" in sys.argv: | ||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': ':memory:', | ||
"default": { | ||
"ENGINE": "django.db.backends.sqlite3", | ||
"NAME": ":memory:", | ||
} | ||
} | ||
else: | ||
DATABASES = { | ||
'default': dj_database_url.config( | ||
default='postgresql://postgres:postgres@localhost:5432/mysite', | ||
conn_max_age=600 | ||
) | ||
} | ||
# else: | ||
# DATABASES = { | ||
# "default": env.db("DATABASE_URL", default="postgres:///new_store"), | ||
# } | ||
# DATABASES["default"]["ATOMIC_REQUEST"] = True | ||
# "default": dj_database_url.config( | ||
# default="postgresql://postgres:postgres@localhost:5432/mysite", | ||
# conn_max_age=600 | ||
# ) | ||
# } | ||
else: | ||
DATABASES = { | ||
"default": env.db("DATABASE_URL", default="postgres:///new_store"), | ||
} | ||
DATABASES["default"]["ATOMIC_REQUEST"] = True | ||
|
||
|
||
|
||
|
@@ -158,42 +158,42 @@ | |
|
||
AUTH_PASSWORD_VALIDATORS = [ | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', | ||
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', | ||
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', | ||
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', | ||
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", | ||
}, | ||
] | ||
|
||
# Internationalization settings | ||
LANGUAGE_CODE = 'en-us' | ||
TIME_ZONE = 'UTC' | ||
LANGUAGE_CODE = "en-us" | ||
TIME_ZONE = "UTC" | ||
USE_I18N = True | ||
USE_TZ = True | ||
|
||
|
||
# Static file settings | ||
STATIC_URL = '/static/' | ||
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')] | ||
STATIC_ROOT = os.path.join(BASE_DIR, 'static_root') | ||
STATIC_URL = "/static/" | ||
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")] | ||
STATIC_ROOT = os.path.join(BASE_DIR, "static_root") | ||
|
||
|
||
# Media file settings | ||
MEDIA_URL = '/media/' | ||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media') | ||
MEDIA_URL = "/media/" | ||
MEDIA_ROOT = os.path.join(BASE_DIR, "media") | ||
|
||
|
||
if not DEBUG: | ||
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') | ||
MEDIA_ROOT = os.path.join(BASE_DIR, 'mediafiles') | ||
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' | ||
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles") | ||
MEDIA_ROOT = os.path.join(BASE_DIR, "mediafiles") | ||
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" | ||
|
||
|
||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' | ||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' | ||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" | ||
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
class ProductsConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'products' | ||
default_auto_field = "django.db.models.BigAutoField" | ||
name = "products" |
Oops, something went wrong.