serve static files in production

This commit is contained in:
w 2024-11-13 00:02:07 +01:00
parent 39c78da89a
commit dee00a514a
3 changed files with 8 additions and 4 deletions

View file

@ -18,4 +18,4 @@ COPY app/ app/
WORKDIR /src/app
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
CMD ["gunicorn", "moneropro.wsgi:application", "--bind", "0.0.0.0:8000"]

View file

@ -21,11 +21,11 @@ BASE_DIR = Path(__file__).resolve().parent.parent
#Comment for Local:
DEBUG = False
#STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
#Comment for deploy:
DEBUG = True
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static"),]
#DEBUG = True
#STATICFILES_DIRS = [os.path.join(BASE_DIR, "static"),]
STATIC_URL = '/static/'
LOCALE_PATHS = (

View file

@ -18,7 +18,11 @@ from django.contrib import admin
from django.urls import path
from charts import views
from django.conf import settings
from django.views.static import serve
urlpatterns = [
path('admin/', admin.site.urls),
url(r'', include(('charts.urls', 'charts'), namespace='charts')),
url(r'^static/(?P<path>.*)$', serve,{'document_root': settings.STATIC_ROOT})
]