made production changes and added post user foreign key relation

This commit is contained in:
Alexander Schulz
2024-08-30 17:52:52 +02:00
parent 014b3995ae
commit 144263cf8c
132 changed files with 27 additions and 31853 deletions

View File

@ -25,7 +25,7 @@ SECRET_KEY = 'django-insecure-ccko-c%pu^i0ipz!#p7zb5)^6fxn0j081udo56_28ik@u5s#@w
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['192.168.2.13', '192.168.2.199']
ALLOWED_HOSTS = ['localhost', '192.168.2.199', 'develop.artemisneo.com']
# Application definition
@ -122,18 +122,21 @@ USE_TZ = True
# https://docs.djangoproject.com/en/5.1/howto/static-files/
STATIC_URL = 'static/'
MEDIA_URL = 'media/'
STATIC_ROOT = BASE_DIR / 'assets'
MEDIA_ROOT = BASE_DIR / 'media'
# Default primary key field type
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
import os
#STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static/')
BASE_DIR / 'static/'
]
MEDIA_URL = 'media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

View File

@ -15,12 +15,15 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,include
from django.urls import path, include, re_path
from . import views
from django.conf.urls.static import static
from django.conf import settings
from django.views.static import serve
urlpatterns = [
re_path(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}),
re_path(r'^static/(?P<path>.*)$', serve, {'document_root': settings.STATIC_ROOT}),
path('admin/', admin.site.urls),
path('', views.hompage),
path('about/',views.about),
@ -28,4 +31,5 @@ urlpatterns = [
path('users/', include('users.urls'))
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
#urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) replaced by -> regular expressions