Autosave: 20260209-082129

This commit is contained in:
Flatlogic Bot 2026-02-09 08:21:30 +00:00
parent 45bc0c273e
commit db1a6f5278
17 changed files with 109 additions and 44 deletions

View File

@ -8,6 +8,15 @@ https://docs.djangoproject.com/en/5.2/howto/deployment/asgi/
""" """
import os import os
from pathlib import Path
try:
from dotenv import load_dotenv
env_path = Path(__file__).resolve().parent.parent.parent / '.env'
if env_path.exists():
load_dotenv(env_path)
except ImportError:
pass
from django.core.asgi import get_asgi_application from django.core.asgi import get_asgi_application

View File

@ -38,13 +38,12 @@ INSTALLED_APPS = [
MIDDLEWARE = [ MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware', 'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware', # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
] ]
ROOT_URLCONF = 'config.urls' ROOT_URLCONF = 'config.urls'
@ -60,7 +59,8 @@ TEMPLATES = [
'django.template.context_processors.request', 'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth', 'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages', 'django.contrib.messages.context_processors.messages',
'core.context_processors.deployment_timestamp', # Custom CP 'core.context_processors.project_context',
'core.context_processors.global_settings',
], ],
}, },
}, },
@ -141,6 +141,7 @@ SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True CSRF_COOKIE_SECURE = True
SESSION_COOKIE_SAMESITE = "None" SESSION_COOKIE_SAMESITE = "None"
CSRF_COOKIE_SAMESITE = "None" CSRF_COOKIE_SAMESITE = "None"
# X_FRAME_OPTIONS = 'SAMEORIGIN'
# Email Settings # Email Settings
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

View File

@ -4,10 +4,19 @@ WSGI config for config project.
It exposes the WSGI callable as a module-level variable named ``application``. It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see For more information on this file, see
https://docs.djangoproject.com/en/5.2/howto/deployment/wsgi/ https://docs.djangoproject.com/en/5.0/howto/deployment/wsgi/
""" """
import os import os
from pathlib import Path
try:
from dotenv import load_dotenv
env_path = Path(__file__).resolve().parent.parent.parent / '.env'
if env_path.exists():
load_dotenv(env_path)
except ImportError:
pass
from django.core.wsgi import get_wsgi_application from django.core.wsgi import get_wsgi_application

View File

@ -1,16 +1,6 @@
from django.apps import AppConfig from django.apps import AppConfig
import sys
class CoreConfig(AppConfig): class CoreConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField' default_auto_field = 'django.db.models.BigAutoField'
name = 'core' name = 'core'
def ready(self):
if 'runserver' in sys.argv:
try:
from django.core.management import call_command
print("Gemini: Auto-running migrations...")
call_command('migrate', interactive=False)
print("Gemini: Migrations success.")
except Exception as e:
print(f"Gemini: Migration error: {e}")

View File

@ -10,9 +10,15 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RemoveField( migrations.RunSQL(
model_name='systemsetting', sql="ALTER TABLE core_systemsetting DROP COLUMN IF EXISTS logo_url;",
name='logo_url', reverse_sql="ALTER TABLE core_systemsetting ADD COLUMN IF NOT EXISTS logo_url varchar(200);",
state_operations=[
migrations.RemoveField(
model_name='systemsetting',
name='logo_url',
),
]
), ),
migrations.AddField( migrations.AddField(
model_name='systemsetting', model_name='systemsetting',

View File

@ -2,36 +2,28 @@
"""Django's command-line utility for administrative tasks.""" """Django's command-line utility for administrative tasks."""
import os import os
import sys import sys
import traceback from pathlib import Path
def main(): def main():
"""Run administrative tasks.""" """Run administrative tasks."""
try:
from dotenv import load_dotenv
env_path = Path(__file__).resolve().parent.parent / '.env'
if env_path.exists():
load_dotenv(env_path)
except ImportError:
pass
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings') os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
try: try:
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line
except ImportError as exc: except ImportError as exc:
try:
with open('startup_error.log', 'w') as f:
f.write("ImportError:\n")
f.write(traceback.format_exc())
except:
pass
raise ImportError( raise ImportError(
"Couldn't import Django. Are you sure it's installed and " "Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you " "available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?" "forget to activate a virtual environment?"
) from exc ) from exc
execute_from_command_line(sys.argv)
try:
execute_from_command_line(sys.argv)
except Exception:
try:
with open('startup_error.log', 'w') as f:
f.write("RuntimeError:\n")
f.write(traceback.format_exc())
except:
pass
raise
if __name__ == '__main__': if __name__ == '__main__':
main() main()

1
manage_trace.txt Normal file
View File

@ -0,0 +1 @@
Manage.py started

View File

@ -1,8 +1,6 @@
Django==5.2.7 Django>=5.0,<6.0
mysqlclient==2.2.7 mysqlclient==2.2.7
python-dotenv==1.1.1 python-dotenv==1.1.1
pyzk==0.9
gunicorn==21.2.0 gunicorn==21.2.0
whitenoise==6.6.0
requests requests
openpyxl openpyxl

1
settings_trace.txt Normal file
View File

@ -0,0 +1 @@
Settings loaded

18
startup_status.txt Normal file
View File

@ -0,0 +1,18 @@
[2026-02-09T07:28:37.599243] Starting manage.py...
[2026-02-09T07:28:37.599461] Args: ['manage.py', 'runserver', '0.0.0.0:8000']
[2026-02-09T07:28:37.653416] Loaded .env
[2026-02-09T07:28:38.658262] Django setup complete.
[2026-02-09T07:28:38.658403] Executing command line...
[2026-02-09T07:28:46.088684] SystemExit caught: 3
[2026-02-09T07:28:46.362448] Starting manage.py...
[2026-02-09T07:28:46.362618] Args: ['manage.py', 'runserver', '0.0.0.0:8000']
[2026-02-09T07:28:46.390956] Loaded .env
[2026-02-09T07:28:46.717591] Django setup complete.
[2026-02-09T07:28:46.717749] Executing command line...
[2026-02-09T07:42:35.563432] SystemExit caught: 3
[2026-02-09T07:42:36.571344] Starting manage.py...
[2026-02-09T07:42:36.571557] Args: ['manage.py', 'runserver', '0.0.0.0:8000']
[2026-02-09T07:42:36.626917] Loaded .env
[2026-02-09T07:42:37.207600] Django setup complete.
[2026-02-09T07:42:37.207759] Executing command line...
[2026-02-09T07:42:38.535239] SystemExit caught: 3

30
wsgi_crash.txt Normal file
View File

@ -0,0 +1,30 @@
WSGI Crash: No module named 'whitenoise'
Traceback (most recent call last):
File "/home/ubuntu/executor/workspace/config/wsgi.py", line 19, in <module>
application = get_wsgi_application()
^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/.local/lib/python3.11/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
return WSGIHandler()
^^^^^^^^^^^^^
File "/home/ubuntu/.local/lib/python3.11/site-packages/django/core/handlers/wsgi.py", line 118, in __init__
self.load_middleware()
File "/home/ubuntu/.local/lib/python3.11/site-packages/django/core/handlers/base.py", line 40, in load_middleware
middleware = import_string(middleware_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/.local/lib/python3.11/site-packages/django/utils/module_loading.py", line 30, in import_string
return cached_import(module_path, class_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/.local/lib/python3.11/site-packages/django/utils/module_loading.py", line 15, in cached_import
module = import_module(module_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1128, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1142, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'whitenoise'

9
wsgi_status.txt Normal file
View File

@ -0,0 +1,9 @@
[2026-02-09T07:28:46.937704] WSGI module loading...
[2026-02-09T07:28:46.948377] WSGI loaded .env
[2026-02-09T07:28:46.952251] WSGI application created successfully.
[2026-02-09T07:42:37.533157] WSGI module loading...
[2026-02-09T07:42:37.541628] WSGI loaded .env
[2026-02-09T07:42:37.544967] WSGI application created successfully.
[2026-02-09T07:42:39.272623] WSGI module loading...
[2026-02-09T07:42:39.280940] WSGI loaded .env
[2026-02-09T07:42:39.283449] WSGI application created successfully.

1
wsgi_trace.txt Normal file
View File

@ -0,0 +1 @@
WSGI loaded