Skip to content

Commit

Permalink
chore(fix): Added get csrf token implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
happychuks committed Aug 21, 2024
1 parent 0f775f0 commit 3917e9e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
19 changes: 19 additions & 0 deletions server/apps/research/migrations/0009_alter_article_thumb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 5.0.8 on 2024-08-21 12:39

import apps.research.models.article
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('research', '0008_alter_article_content'),
]

operations = [
migrations.AlterField(
model_name='article',
name='thumb',
field=models.ImageField(blank=True, default=apps.research.models.article.get_default_thumb, upload_to='images/'),
),
]
1 change: 0 additions & 1 deletion server/core/config/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
MEDIA_URL = 'https://cms.2077.xyz/media/'

MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

Expand Down
1 change: 1 addition & 0 deletions server/core/config/local.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .base import *

MEDIA_URL = '/media/'

CSRF_TRUSTED_ORIGINS = [
'http://127.0.0.1:8000',
Expand Down
20 changes: 17 additions & 3 deletions server/core/config/production.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
from .base import *

MEDIA_URL = 'https://cms.2077.xyz/media/'

DEBUG = bool(config('DJANGO_DEBUG', default=False))

ALLOWED_HOSTS = ['74.119.195.253', 'cms.2077.xyz']

CSRF_TRUSTED_ORIGINS = ["https://" + host for host in ALLOWED_HOSTS]
CSRF_TRUSTED_ORIGINS = []
for host in ALLOWED_HOSTS:
CSRF_TRUSTED_ORIGINS.append(f"https://{host}")
CSRF_TRUSTED_ORIGINS.append(f"http://{host}")

CORS_ALLOWED_ORIGINS = [
"https://cms.2077.xyz", # Https version of Django
"http://74.119.195.253", # Http version of Astro
"http://127.0.0.1:4321", # Local Dev
"http://localhost:4321", # Local Dev
]

CORS_ALLOW_CREDENTIALS = True

#REDISCLOUD_URL = config("REDISCLOUD_URL")

Expand All @@ -27,7 +41,7 @@

CSP_SCRIPT_SRC = ("self",)

CSP_IMG_SRC = ("self", "http://cms.2077.xyz", "https:cms.2077.xyz")
CSP_IMG_SRC = ("self", "http://cms.2077.xyz", "https://cms.2077.xyz", "http://74.119.195.253")

CSP_FONT_SRC = ("self",)

Expand All @@ -43,4 +57,4 @@

SECURE_SSL_REDIRECT = False

SESSION_COOKIE_SECURE = True
SESSION_COOKIE_SECURE = True

0 comments on commit 3917e9e

Please sign in to comment.