如何从gunicorn或nginx提供静态文件

我正在玩docker工程。 Django +一个容器中的gunicorn,另一个容器中的nginx。

当我从Django dev服务器切换到gunicorn时,我注意到我的所有静态文件都没有被提供。 我一直试图解决这个问题,认为这是一个nginx问题,但如果我访问的Django / gunicorn(而不是nginx)的容器,我也看不到静态文件显示在这里,所以这让我觉得这不是一个nginx的问题,但只是在我的Django设置一个简单的错误?

Django settings.py

DEBUG = False STATIC_ROOT = os.path.join(PACKAGE_ROOT, "static1") STATIC_URL = "/static/" STATICFILES_DIRS = [ os.path.join(PACKAGE_ROOT, "static"), ] STATICFILES_FINDERS = [ "django.contrib.staticfiles.finders.FileSystemFinder", "django.contrib.staticfiles.finders.AppDirectoriesFinder", ] 

nginx的

 server { listen 80; server_name example.org; charset utf-8; location /static { alias /root/proj/proj/static; } } 

注意:我将这个别名设置为/ root / proj / proj / static,因为这是静态文件实际位于Django / gunicorn容器内部的目录path…我正确地设置别名到这个path吗?

泊坞窗,撰写

 parentserver: build: ./parentserver expose: - "8000" links: - postgres:postgres - authserver:authserver volumes: - /usr/src/app - /usr/src/app/static env_file: .env environment: DEBUG: 'true' command: ./startup.sh nginx: build: ./nginx/ ports: - "80:80" volumes: - /www/static volumes_from: - parentserver links: - parentserver:parentserver 

我的卷设置错了吗?

将不胜感激任何反馈意见。