Skip to content

Commit 26a5bbb

Browse files
🎉 start project
1 parent 4e94a43 commit 26a5bbb

17 files changed

+280
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
__pycache__/
33
*.py[cod]
44
*$py.class
5+
.idea/
56

67
# C extensions
78
*.so
@@ -109,6 +110,8 @@ venv/
109110
ENV/
110111
env.bak/
111112
venv.bak/
113+
dev.env
114+
prod.env
112115

113116
# Spyder project settings
114117
.spyderproject

dinner_time/apps/api/__init__.py

Whitespace-only changes.

dinner_time/apps/api/admin.py

Whitespace-only changes.

dinner_time/apps/api/apps.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class ApiConfig(AppConfig):
5+
name = 'api'

dinner_time/apps/api/models.py

Whitespace-only changes.

dinner_time/apps/api/serializers.py

Whitespace-only changes.

dinner_time/apps/api/tests.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.test import TestCase
2+
3+
# Create your tests here.

dinner_time/apps/api/urls.py

Whitespace-only changes.

dinner_time/apps/api/views.py

Whitespace-only changes.

dinner_time/backend_settings/__init__.py

Whitespace-only changes.
+155
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
"""
2+
Django settings for backend_settings project.
3+
4+
Generated by 'django-admin startproject' using Django 2.2.10.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/2.2/topics/settings/
8+
9+
For the full list of settings and their values, see
10+
https://docs.djangoproject.com/en/2.2/ref/settings/
11+
"""
12+
13+
import os
14+
15+
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16+
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17+
18+
# Quick-start development settings - unsuitable for production
19+
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
20+
21+
# SECURITY WARNING: keep the secret key used in production secret!
22+
SECRET_KEY = 'h_@ef_kz1t@$8&o!!qz!0oc5usvdu5all(oqjus+a-+kbl&cdz'
23+
24+
# SECURITY WARNING: don't run with debug turned on in production!
25+
DEBUG = True
26+
27+
ALLOWED_HOSTS = ['*']
28+
29+
# Application definition
30+
31+
INSTALLED_APPS = [
32+
'jet.dashboard',
33+
'jet',
34+
'django.contrib.admin',
35+
'django.contrib.auth',
36+
'django.contrib.contenttypes',
37+
'django.contrib.sessions',
38+
'django.contrib.messages',
39+
'django.contrib.staticfiles',
40+
'rest_framework',
41+
'apps.api',
42+
'sorl.thumbnail',
43+
'django_filters',
44+
'easy_thumbnails',
45+
]
46+
47+
MIDDLEWARE = [
48+
'django.middleware.security.SecurityMiddleware',
49+
'whitenoise.middleware.WhiteNoiseMiddleware',
50+
'django.contrib.sessions.middleware.SessionMiddleware',
51+
'django.middleware.common.CommonMiddleware',
52+
'django.middleware.csrf.CsrfViewMiddleware',
53+
'django.contrib.auth.middleware.AuthenticationMiddleware',
54+
'django.contrib.messages.middleware.MessageMiddleware',
55+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
56+
]
57+
58+
MIDDLEWARE_CLASSES = (
59+
'whitenoise.middleware.WhiteNoiseMiddleware',
60+
)
61+
62+
ROOT_URLCONF = 'backend_settings.urls'
63+
64+
TEMPLATES = [
65+
{
66+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
67+
'DIRS': [],
68+
'APP_DIRS': True,
69+
'OPTIONS': {
70+
'context_processors': [
71+
'django.template.context_processors.debug',
72+
'django.template.context_processors.request',
73+
'django.contrib.auth.context_processors.auth',
74+
'django.contrib.messages.context_processors.messages',
75+
],
76+
},
77+
},
78+
]
79+
80+
WSGI_APPLICATION = 'backend_settings.wsgi.application'
81+
82+
JET_THEMES = [
83+
{
84+
'theme': 'default', # theme folder name
85+
'color': '#47bac1', # color of the theme's button in user menu
86+
'title': 'Default' # theme title
87+
},
88+
{
89+
'theme': 'green',
90+
'color': '#44b78b',
91+
'title': 'Green'
92+
},
93+
{
94+
'theme': 'light-green',
95+
'color': '#2faa60',
96+
'title': 'Light Green'
97+
},
98+
{
99+
'theme': 'light-violet',
100+
'color': '#a464c4',
101+
'title': 'Light Violet'
102+
},
103+
{
104+
'theme': 'light-blue',
105+
'color': '#5EADDE',
106+
'title': 'Light Blue'
107+
},
108+
{
109+
'theme': 'light-gray',
110+
'color': '#222',
111+
'title': 'Light Gray'
112+
}
113+
]
114+
115+
# Password validation
116+
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
117+
118+
AUTH_PASSWORD_VALIDATORS = []
119+
120+
# Internationalization
121+
# https://docs.djangoproject.com/en/2.2/topics/i18n/
122+
123+
LANGUAGE_CODE = 'ru-ru'
124+
125+
TIME_ZONE = 'UTC'
126+
127+
USE_I18N = True
128+
129+
USE_L10N = True
130+
131+
USE_TZ = True
132+
133+
# Static files (CSS, JavaScript, Images)
134+
# https://docs.djangoproject.com/en/2.2/howto/static-files/
135+
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
136+
STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),)
137+
138+
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
139+
140+
REST_FRAMEWORK = {
141+
'DEFAULT_PAGINATION_CLASS': 'apps.core.pagination.CustomPagination',
142+
'PAGE_SIZE': 1,
143+
'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',),
144+
}
145+
146+
DATE_FORMAT = '%d.%m.%Y'
147+
TIME_FORMAT = '%H:%M:%S'
148+
DATETIME_FORMAT = '%d.%m.%Y'
149+
150+
if os.environ.get('DJANGO_DEVELOPMENT') is not None:
151+
print('Start with DEV settings')
152+
from .settings_dev import *
153+
else:
154+
print('Start with PRODUCTION settings')
155+
from .settings_prod import *
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import os
2+
3+
DEBUG = True
4+
5+
DATABASES = {
6+
'default': {
7+
'ENGINE': 'django.db.backends.postgresql_psycopg2',
8+
'NAME': os.environ['DB_NAME'],
9+
'USER': os.environ['DB_USER'],
10+
'PASSWORD': os.environ['DB_PASSWORD'],
11+
'HOST': os.environ['DB_HOST'],
12+
'PORT': '5432' if not os.environ.get('DB_PORT') else os.environ['DB_PORT'],
13+
}
14+
}
15+
16+
# GOOGLE_MAPS_API_KEY = os.environ['GOOGLE_MAPS_API_KEY']
17+
# URL_BOT_HOSTING = os.environ['URL_BOT_HOSTING']
18+
19+
STATIC_URL = '/staticfiles/'
20+
MEDIA_URL = '/media/'
21+
22+
if os.environ.get('OFF_CSRF_AND_COOKIE_SECURE'):
23+
SESSION_COOKIE_SECURE = False
24+
CSRF_COOKIE_SECURE = False
25+
26+
STATS_CACHE_TIMEOUT = 60
27+
STATS_CACHE_UPDATE_TIMEOUT = 0

dinner_time/backend_settings/settings_prod.py

Whitespace-only changes.

dinner_time/backend_settings/urls.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""backend_settings URL Configuration
2+
3+
The `urlpatterns` list routes URLs to views. For more information please see:
4+
https://docs.djangoproject.com/en/2.2/topics/http/urls/
5+
Examples:
6+
Function views
7+
1. Add an import: from my_app import views
8+
2. Add a URL to urlpatterns: path('', views.home, name='home')
9+
Class-based views
10+
1. Add an import: from other_app.views import Home
11+
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
12+
Including another URLconf
13+
1. Import the include() function: from django.urls import include, path
14+
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
15+
"""
16+
from django.conf import settings
17+
from django.conf.urls.static import static
18+
from django.contrib import admin
19+
from django.urls import path, include
20+
21+
urlpatterns = [
22+
path('jet/', include('jet.urls', 'jet')), # Django JET URLS
23+
path('jet/dashboard/', include('jet.dashboard.urls', 'jet-dashboard')),
24+
path('admin/', admin.site.urls),
25+
path('api/v1/', include('apps.api.urls')),
26+
]
27+
28+
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
29+
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

dinner_time/backend_settings/wsgi.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
WSGI config for backend_settings project.
3+
4+
It exposes the WSGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.wsgi import get_wsgi_application
13+
14+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend_settings.settings')
15+
16+
application = get_wsgi_application()

dinner_time/manage.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env python
2+
"""Django's command-line utility for administrative tasks."""
3+
import os
4+
import sys
5+
6+
7+
def main():
8+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend_settings.settings')
9+
try:
10+
from django.core.management import execute_from_command_line
11+
except ImportError as exc:
12+
raise ImportError(
13+
"Couldn't import Django. Are you sure it's installed and "
14+
"available on your PYTHONPATH environment variable? Did you "
15+
"forget to activate a virtual environment?"
16+
) from exc
17+
execute_from_command_line(sys.argv)
18+
19+
20+
if __name__ == '__main__':
21+
main()

requirements.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
djangorestframework==3.10.3
2+
django==2.2.10
3+
django-jet==1.0.8
4+
sorl-thumbnail==12.5.0
5+
pillow==6.2.1
6+
psycopg2-binary==2.7.5
7+
sorl-thumbnail==12.5.0
8+
django_filter==2.2.0
9+
supervisor==4.1.0
10+
transliterate==1.10.2
11+
gunicorn==20.0.4
12+
whitenoise==5.0.1
13+
pytest==5.3.3
14+
pytest-cov==2.8.1
15+
pytest-django==3.8.0
16+
Celery==4.4.0
17+
redis==3.4.1
18+
Pillow==6.2.1
19+
django-widget-tweaks==1.4.5
20+
easy-thumbnails==2.7
21+
codecov==2.0.22

0 commit comments

Comments
 (0)