master
11617 2 years ago
parent 81d485842e
commit 142f4b2147
  1. 4
      djangoProject/settings.py
  2. 3
      djangoProject/wsgi.py
  3. 13
      docker-entrypoint.sh

@ -133,11 +133,13 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.2/howto/static-files/
STATIC_URL = '/static/'
STATIC_URL = '/staticfiles/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
os.path.join(BASE_DIR, 'upload'),
os.path.join(BASE_DIR, 'staticfiles'),
)
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field

@ -9,8 +9,9 @@ https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
import os
from django.contrib.staticfiles.handlers import StaticFilesHandler
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangoProject.settings')
application = get_wsgi_application()
application = StaticFilesHandler(get_wsgi_application())

@ -1,9 +1,10 @@
echo "启动成功"
sleep 10
mkdir -p upload/images
python manage.py migrate
# python manage.py runserver 0.0.0.0:8000
# /var/log/django.log
gunicorn \
--workers 8 \
--bind 0.0.0.0:8000 \
djangoProject.wsgi:application
python manage.py collectstatic
gunicorn --workers 8 \
--bind 0.0.0.0:8000 \
djangoProject.wsgi:application \
--log-level info \
--access-logfile /var/log/myblog.log
Loading…
Cancel
Save