python - Serving django static files with Apache -
i'm trying learn django, however, can't apache serve static files. i've tried using development server or gunicorn both running on port 8000.
i can access page fine, bootstrap not loaded. also, when i'm trying open static files directly (mydomain.com:8000/static/app/css/bootstrap.min.css) "connection refused".
<virtualhost *:8000> documentroot /home/django/project/ servername mydomain.com alias /static /home/django/project/static <directory /home/django/project/static> require granted </directory>
root@ip-:~# tree -dc /home/django/project/ /home/django/project/ |-- app | |-- templates | | `-- app | | `-- includes | |-- __pycache__ | |-- static | | `-- app | | `-- bootstrap-3.3.6-dist | | |-- css | | |-- fonts | | `-- js | `-- migrations | `-- __pycache__ |-- static | |-- admin | | |-- css | | |-- fonts | | |-- img | | | `-- gis | | `-- js | | |-- admin | | `-- vendor | | |-- jquery | | `-- xregexp | |-- bootstrap-3.3.6-dist | | |-- css | | |-- fonts | | `-- js | `-- app | |-- bootstrap-3.3.6-dist | | |-- css | | |-- fonts | | `-- js | |-- css | |-- fonts | `-- js `-- project `-- __pycache__
from settings.py:
# static files (css, javascript, images) # https://docs.djangoproject.com/en/1.9/howto/static-files/ static_url = '/static/' static_root = os.path.join(base_dir, "static/") staticfiles_dirs = (os.path.join(os.path.dirname(__file__),'static'),)
Comments
Post a Comment