python - Django isn't serving static files -


i'm working existing (and functional) django site. upgraded django 1.8.13 1.10 , our wsgi gunicorn. works fine when hosted development machine, when deployed, static resources (on admin , main site) yield 404's message, directory indexes not allowed here.

our settings.py contains following:

installed_apps = (     ...     'django.contrib.staticfiles',     ... )  debug = true static_url = '/static/' project_dir = os.path.dirname(os.path.dirname(__file__)) staticfiles_dirs = (     os.path.join(project_dir, 'static'), ) static_root = os.path.join(project_dir, 'static_resources') 

the directory structure looks this:

/my-project-name     /my-project-name         server.py         settings.py         urls.py         wsgi.py     ...     /static     /static_resources     manage.py 

django not serve static files in production mode (debug=false). on production deployment that's job of webserver. resolve problem:

  • run python manage.py collectstatic
  • in web server configuration point /static folder static folder of django

don't turn debug on, dangerous!


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -