This commit is contained in:
Eugene Pankov
2021-09-02 22:54:22 +02:00
parent e541269392
commit eac64152b8
7 changed files with 69 additions and 12 deletions

1
backend/.gitignore vendored
View File

@@ -1,2 +1,3 @@
__pycache__
db.sqlite3
public

17
backend/poetry.lock generated
View File

@@ -602,6 +602,17 @@ category = "main"
optional = false
python-versions = ">=3.6.1"
[[package]]
name = "whitenoise"
version = "5.3.0"
description = "Radically simplified static file serving for WSGI applications"
category = "main"
optional = false
python-versions = ">=3.5, <4"
[package.extras]
brotli = ["brotli"]
[[package]]
name = "zipp"
version = "3.4.1"
@@ -630,7 +641,7 @@ testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"]
[metadata]
lock-version = "1.1"
python-versions = "^3.7"
content-hash = "a855859b9c8eb70c722c6e1ce320e3b4a8b554b8eeb12e42cfaea4dce857855d"
content-hash = "bb7f88af57c4e8e37ff32e12d3f8627cd64aef874617d88c68fa0f16be8a6de1"
[metadata.files]
asgiref = [
@@ -949,6 +960,10 @@ websockets = [
{file = "websockets-9.1-cp39-cp39-win_amd64.whl", hash = "sha256:85db8090ba94e22d964498a47fdd933b8875a1add6ebc514c7ac8703eb97bbf0"},
{file = "websockets-9.1.tar.gz", hash = "sha256:276d2339ebf0df4f45df453923ebd2270b87900eda5dfd4a6b0cfa15f82111c3"},
]
whitenoise = [
{file = "whitenoise-5.3.0-py2.py3-none-any.whl", hash = "sha256:d963ef25639d1417e8a247be36e6aedd8c7c6f0a08adcb5a89146980a96b577c"},
{file = "whitenoise-5.3.0.tar.gz", hash = "sha256:d234b871b52271ae7ed6d9da47ffe857c76568f11dd30e28e18c5869dbd11e12"},
]
zipp = [
{file = "zipp-3.4.1-py3-none-any.whl", hash = "sha256:51cb66cc54621609dd593d1787f286ee42a5c0adbb4b29abea5a63edc3e03098"},
{file = "zipp-3.4.1.tar.gz", hash = "sha256:3607921face881ba3e026887d8150cca609d517579abe052ac81fc5aeffdbd76"},

0
backend/public/.gitkeep Normal file
View File

View File

@@ -23,6 +23,7 @@ pyga = "^2.6.2"
django-cors-headers = "^3.7.0"
cryptography = "3.0"
fsspec = "^2021.7.0"
whitenoise = "^5.3.0"
[tool.poetry.dev-dependencies]
flake8 = "^3.9.2"

View File

@@ -42,6 +42,7 @@ INSTALLED_APPS = [
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
@@ -145,6 +146,7 @@ LOGGING = {
STATIC_URL = '/static/'
STATICFILES_DIRS = [FRONTEND_BUILD_DIR]
STATIC_ROOT = BASE_DIR / 'public'
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

View File

@@ -1,15 +1,10 @@
from django.conf import settings
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.urls import path, include
from django.views.static import serve
from .app.urls import urlpatterns as app_urlpatterns
urlpatterns = [
path('', include(app_urlpatterns)),
path('api/1/auth/social/', include('social_django.urls', namespace='social')),
path('admin/', admin.site.urls),
# path(f'{settings.STATIC_URL.strip("/")}/<path:path>', serve, kwargs={
# 'document_root': settings.STATIC_ROOT,
# }),
] + staticfiles_urlpatterns(settings.STATIC_URL)
]