mirror of
https://github.com/wahyd4/links.git
synced 2026-08-09 05:06:16 +10:00
Update docker related stuff
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
data
|
||||
k8s
|
||||
3.12
|
||||
.github
|
||||
README.md
|
||||
@@ -67,3 +67,4 @@ coverage.xml
|
||||
# Tailwind CSS
|
||||
/static/css/dist/
|
||||
node_modules/
|
||||
/data
|
||||
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/Users/junv/code/links/3.12/bin/python3.12
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from gunicorn.app.wsgiapp import run
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(run())
|
||||
+2
-1
@@ -39,8 +39,9 @@ RUN python manage.py compilemessages --locale=zh_Hans
|
||||
# Create data directory for SQLite database
|
||||
RUN mkdir -p /app/data && chmod 777 /app/data
|
||||
|
||||
ENV PYTHONPATH=/app
|
||||
# Expose port 8000
|
||||
EXPOSE 8000
|
||||
|
||||
# Run the application
|
||||
CMD ["gunicorn", "url_manager.wsgi:application", "--bind", "0.0.0.0:8000"]
|
||||
CMD ["gunicorn", "--chdir", "/app", "url_manager.wsgi:application", "--bind", "0.0.0.0:8000"]
|
||||
|
||||
+5
-2
@@ -5,7 +5,6 @@ metadata:
|
||||
labels:
|
||||
tags.datadoghq.com/env: "prod"
|
||||
tags.datadoghq.com/service: "links"
|
||||
tags.datadoghq.com/version: "{{IMAGE_VERSION}}"
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
@@ -17,8 +16,12 @@ spec:
|
||||
app: links
|
||||
tags.datadoghq.com/env: "prod"
|
||||
tags.datadoghq.com/service: "links"
|
||||
tags.datadoghq.com/version: "{{IMAGE_VERSION}}"
|
||||
spec:
|
||||
initContainers:
|
||||
- name: run-migrations
|
||||
image: "ghcr.io/wahyd4/links:main"
|
||||
command: ['python', 'manage.py', 'migrate']
|
||||
|
||||
containers:
|
||||
- name: links
|
||||
image: "ghcr.io/wahyd4/links:main"
|
||||
|
||||
@@ -7,3 +7,5 @@ django-tailwind==3.8.0
|
||||
# chart.js==3.7.0
|
||||
# Add this line to your requirements.txt file
|
||||
fontawesome-free==5.15.3
|
||||
gunicorn==20.1.0
|
||||
whitenoise==5.3.0
|
||||
|
||||
+11
-3
@@ -11,17 +11,18 @@ INSTALLED_APPS = [
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'widget_tweaks', # 确保这行在这里
|
||||
'django.contrib.staticfiles', # Make sure this is here only once
|
||||
'widget_tweaks',
|
||||
'links',
|
||||
'tailwind',
|
||||
'new_theme', # Add 'theme' back here
|
||||
'new_theme',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'url_manager.urls'
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'whitenoise.middleware.WhiteNoiseMiddleware', # Add this line
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.locale.LocaleMiddleware', # Make sure this is here
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
@@ -66,6 +67,10 @@ DATABASES = {
|
||||
# 静态文件设置
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = BASE_DIR / 'staticfiles'
|
||||
STATICFILES_DIRS = [
|
||||
BASE_DIR / "static",
|
||||
BASE_DIR / "theme" / "static",
|
||||
]
|
||||
|
||||
# 默认自动字段类型
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
@@ -98,3 +103,6 @@ TAILWIND_APP_NAME = 'new_theme'
|
||||
INTERNAL_IPS = [
|
||||
"127.0.0.1",
|
||||
]
|
||||
|
||||
# Add this at the end of the file
|
||||
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import os
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'url_manager.settings')
|
||||
|
||||
application = get_wsgi_application()
|
||||
Reference in New Issue
Block a user