Skip to content

Commit

Permalink
Merge pull request #29 from hungpham3112/front_end_nightly
Browse files Browse the repository at this point in the history
Front end nightly
  • Loading branch information
hungpham3112 authored Feb 13, 2024
2 parents baa88af + 003071d commit 3b0b689
Show file tree
Hide file tree
Showing 1,268 changed files with 840 additions and 290 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ contact/__pycache__/
contact/migrations/__pycache__/
home/__pycache__/
home/migrations/__pycache__/
ai_web/secret_key.py
.env
static/uploads/
2 changes: 2 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ gunicorn = "*"
whitenoise = "*"
django-sslserver = "*"
pillow = "*"
python-dotenv = "*"
django-ckeditor = "*"

[dev-packages]

Expand Down
573 changes: 310 additions & 263 deletions Pipfile.lock

Large diffs are not rendered by default.

40 changes: 30 additions & 10 deletions ai_web/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
import os
from pathlib import Path
from django.utils.translation import gettext_lazy as _
from dotenv import load_dotenv

load_dotenv()

# 2023-05-02 10:39 phamhung20022015
# [Note]: Lưu ý các đoạn code được comment ở dưới là optional
# vi lý do hầu hết là khiến hiệu năng của trang giảm nên phải
# tắt đi, trong tương lai nếu muốn active thì cần nghiên cứu kĩ lại
# để tránh làm hỏng code cũ.

env = environ.Env(
# set casting, default value
Expand All @@ -39,6 +48,8 @@

ALLOWED_HOSTS = ["*"]

WSGI_APPLICATION = 'vercel_app.wsgi.app'

# Application definition

INSTALLED_APPS = [
Expand Down Expand Up @@ -151,43 +162,52 @@

# Default primary key field type
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
# Prevent add uploads file to the repo
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]

MEDIA_URL = "/media/"
MEDIA_ROOT = os.path.join(BASE_DIR, "static/uploads")

# Supporting for forever-cacheable files and compression
# More details: https://whitenoise.readthedocs.io/en/stable/django.html
# [Note]: 2023-04-29 14:02 [email protected]
# Enable storage will fail `python manage.py test`
# STORAGES = {
# 2023-04-29 14:02 [email protected]
# [Note]: Enable storage will fail `python manage.py test`
# STORAGES = {
# "staticfiles": {
# "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
# },
# }

# Rich text editor with ckeditor
CKEDITOR_UPLOAD_PATH = "uploads/"

CKEDITOR_CONFIGS = {
"default": {"toolbar": "full", "height": 300, "width": "100%"},
}

CKEDITOR_STORAGE_BACKEND = "django.core.files.storage.FileSystemStorage"


# production
if ENVIRONMENT == "production":
DEBUG = False
SECURE_BROWSER_XSS_FILTER = True # prevent cross-site scripting(XSS) attack
X_FRAME_OPTIONS = "DENY" # prevent clickjacking attack
SECURE_HSTS_SECONDS = 3600
SECURE_HSTS_INCLUDE_SUBDOMAINS = (
True # force any subdomains to also exclusively use SSL
)
SECURE_HSTS_PRELOAD = True
# SECURE_HSTS_SECONDS = 3600
# SECURE_HSTS_INCLUDE_SUBDOMAINS = (
# True # force any subdomains to also exclusively use SSL
# )
# SECURE_HSTS_PRELOAD = True
SECURE_CONTENT_TYPE_NOSNIFF = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
# CSRF_COOKIE_SECURE = True
CSRF_TRUSTED_ORIGINS = ["https://*.railway.app", "https://www.*.railway.app", "https://*.onrender.com",
"https://www.*.onrender.com"]

# [Note]: 2023-04-29 13:43 [email protected]
# Khi triển khai trang lên server thì 2 tùy chỉnh dưới đây sẽ tăng bảo mật nhưng sẽ đánh đổi
# về mặt độ trễ khi chuyển trang. Trong trường hợp yêu cầu cao về bảo mật ko thì False
# về mặt độ trễ khi chuyển trang. Trong trường hợp yêu cầu cao về bảo mật nếu ko thì nên False
# để giúp trang load nhanh hơn.
# SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") # prevent browsers from using the website on insecure HTTP connections.
# SECURE_SSL_REDIRECT = True # force all non-HTTPS traffic to be redirected to HTTPS

Expand Down
3 changes: 2 additions & 1 deletion ai_web/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ai_web.settings")

application = get_wsgi_application()
app = get_wsgi_application()

Binary file modified db.sqlite3
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 3b0b689

Please sign in to comment.