I have configured my django application on webfaction, and it is working fine as of now. I wanted to know how to serve my static and media files on apache. Django has a development server which serves these files. I had initially setup apache on my local environment and added many lines of script to serve static and media files via apache.
However, while doing the same on webfaction, as per the webfaction docs I didn't have to do much and that got me thinking that there might be more steps needed to serves these files via apache.
Therefore, I wanted to confirm, are my static and media files running from apache or not? I am afraid that this is the case here as well because I have not yet configured apache to serve these files since in development environment django serves the static and media files are served by django itself.
A typical Django deployment at WebFaction involves at least two application instances:
The Symbolic link to a static-only app expects you to enter the absolute path for the origin of the symlink. This should point to the directory specified by STATIC_ROOT
.
Given an project structure of:
/my-project/
/my-project/
settings.py
...
/static_assets/ (used for local development. Not typically deployed.)
/static/ (used for production)
This would translate to a directory structure at WebFaction like:
/home/
/your-account-name/
/webapps/
/your-django-app-name/
/apache2
/bin
/your-django-app-name (synonymous with "my-project" above)
/static/ (this is what your 'static' symlink path)
/lib
/pythonx.y (modules go here. Django lives here)
When you create your "Website" instance, you will specify your Django app instance to run on /
, and your Symbolic link app instance on the path specified by STATIC_URL
, typically /static
.
You should run with DEBUG = False
at WebFaction, which in turn, causes django.contrib.staticfiles
to not serve any files that are located in STATICFILES_DIRS
.
Hope that helps you out.