Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env_sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Django
DEBUG=True|False
ENV_TYPE=local|stage|develop|prod
11 changes: 0 additions & 11 deletions .vscode/settings.json

This file was deleted.

6 changes: 4 additions & 2 deletions config/celery.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import os
from celery import Celery

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
from django.conf import settings

if settings.DEBUG:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
celery_app = Celery("braniac")
celery_app.config_from_object("django.conf:settings", namespace="CELERY")
celery_app.autodiscover_tasks()
50 changes: 36 additions & 14 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,31 @@
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ.get('django_key')
SECRET_KEY = os.environ.get('SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True


STATIC_URL = '/static/'
MEDIA_URL = '/media/'
DEBUG = False
SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')

if DEBUG:
INTERNAL_IPS = ["127.0.0.1",]
ALLOWED_HOSTS = ['*']
STATICFILES_DIRS = (
os.path.join(SITE_ROOT, 'static/'),
)
else:
ALLOWED_HOSTS = ['127.0.0.1', '192.168.2.81', 'localhost']
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
# STATICFILES_FINDERS = (
# 'django.contrib.staticfiles.finders.FileSystemFinder',
# 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# )


ALLOWED_HOSTS = ['*']


# Application definition
Expand Down Expand Up @@ -91,12 +107,22 @@
# Database
# https://docs.djangoproject.com/en/4.0/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',
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'dz',
'USER': 'myprojectuser',
'PASSWORD': 'password',
'HOST': 'localhost',
'PORT': '',
}
}
}


# Password validation
Expand Down Expand Up @@ -132,19 +158,15 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/

STATIC_URL = 'static/'
SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
STATICFILES_DIRS = (
os.path.join(SITE_ROOT, 'static/'),
)



# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

MEDIA_URL = "/media/"

MEDIA_ROOT = BASE_DIR / "media"
AUTH_USER_MODEL = "authapp.CustomUser"
LOGIN_REDIRECT_URL = "mainapp:main_page"
Expand Down
3 changes: 2 additions & 1 deletion config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
if settings.DEBUG:
import debug_toolbar
urlpatterns.append(path("__debug__/", include(debug_toolbar.urls)))
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
3 changes: 3 additions & 0 deletions gunicorn.conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bind = '192.168.2.81:8000'
workers = 3
user = 'ki'
Loading