Skip to content

changes media #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
40 changes: 19 additions & 21 deletions app/cms/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []
ALLOWED_HOSTS = ['188.40.64.184']

# Application definition

Expand Down Expand Up @@ -108,21 +108,12 @@
'corsheaders.middleware.CorsMiddleware', # para que el backend acepte peticiones de cualquier origen
]

# configurar CSRF_FAILURE_VIEW para que pueda ejecutarse en Azure
# CSRF_FAILURE_VIEW = 'django.views.csrf.csrf_failure'
CSRF_TRUSTED_ORIGINS = ['https://shopcms.azurewebsites.net',
'https://shopcms.azurewebsites.net/',
'https://shopcms.azurewebsites.net/admin/',
'https://shopcms.azurewebsites.net/admin/login/',
'https://shopcms.azurewebsites.net/admin/login/?next=/admin/',
]
CSRF_USE_SESSIONS = False

CORS_ORIGIN_ALLOW_ALL = False # para que el backend acepte peticiones de cualquier origen

CORS_ORIGIN_ALLOW_ALL = True # para que el backend acepte peticiones de cualquier origen
# configuracion de corsheaders para que solo se permita el acceso a la api desde el frontend
CORS_ORIGIN_WHITELIST = [
'http://127.0.0.1:5500',
]
# CORS_ORIGIN_WHITELIST = [
# 'http://127.0.0.1:5500',
# ]

ROOT_URLCONF = 'cms.urls'

Expand Down Expand Up @@ -161,8 +152,12 @@

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'mydatabase',
'USER': 'postgres',
'PASSWORD': 'example',
'HOST': 'db',
'PORT': 5432,
}
}

Expand Down Expand Up @@ -198,10 +193,13 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/

STATIC_URL = 'static/'
STATICFILES_DIRS = [
os.path.join('static'),
]
STATIC_URL = '/static/'
# STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_ROOT = '/app/static/'

# STATICFILES_DIRS = [
# os.path.join('static'),
# ]

# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
Expand Down
2 changes: 1 addition & 1 deletion app/cms/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
path("shop/", include("shop.urls")),
path('dj-rest-auth/', include('dj_rest_auth.urls')),
path('auth/registration/', RegisterView.as_view(), name='rest_register'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

# path("", include("shop.urls", namespace="shop")),
# path('api/auth/', include('rest_auth.urls')),