Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Works with django server but not with Apache mod_wsgi #143

Open
Brazze66 opened this issue May 21, 2019 · 1 comment
Open

Works with django server but not with Apache mod_wsgi #143

Brazze66 opened this issue May 21, 2019 · 1 comment

Comments

@Brazze66
Copy link

It complains about django is not defined and (django.jQuery) is highlighted in index.html
Its weird as it works fine when using Django dev server.
Any idea?
static files are missing when collected?
Using Django 2.2 and Python 3.6

@ls-initiatives
Copy link
Contributor

Don't think it's a bug.
You probably should let Apache serve static files (as noted in the Django docs somewhere), but this app overrides some of the static files and not others.
I followed the Apache docs here and it seems to work for me: https://httpd.apache.org/docs/2.4/en/rewrite/remapping.html#multipledirs
Here's what I have in my Apache site config:

 # serve static admin files, as noted in django docs
 <Directory /usr/local/lib/python3.6/dist-packages/django/contrib/admin/static/admin/>
   AllowOverride None
   Require all granted
 </Directory>
 Alias /static/admin "/usr/local/lib/python3.6/dist-packages/django/contrib/admin/static/admin"
# serve django-admin-bootstrap's own static files for 
 Alias /static/bootstrap_admin /usr/local/lib/python3.6/dist-packages/bootstrap_admin/static/bootstrap_admin
# serve django-admin-bootstrap's version of the admin's static files in priority
 RewriteEngine on
 RewriteCond /usr/local/lib/python3.6/dist-packages/bootstrap_admin/%{REQUEST_URI} -f
 RewriteRule  "^(.+)"  "/usr/local/lib/python3.6/dist-packages/bootstrap_admin/$1"  [L]

The paths should match your own installation of course.
If it works for you, it might be worht adding it to the docs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants