Reputation: 3617
My CSS / JS is not loading when using an alias in the httpd.conf
The site loads with all static files when using the localhost
WSGIScriptAlias / "d:\www\python\skillshare\src\mvp_landing\wsgi.py"
result;
http://localhost/
The site loads but with no css and js when adding the alias
WSGIScriptAlias /picon "d:\www\python\skillshare\src\mvp_landing\wsgi.py"
result;
http://localhost/picon/
My Current Dir structure below;
D:\www\python\skillshare\src\mvp_landing\wsgi.py
D:\www\python\skillshare\src\manage.py
D:\www\python\skillshare\static\static\
D:\www\python\skillshare\static\media\
D:\www\python\skillshare\static\templates\
Below my current httpd.conf (apache2.2);
WSGIScriptAlias /picon "d:\www\python\skillshare\src\mvp_landing\wsgi.py"
<Directory "d:/www/python/skillshare/src/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
My Settings.py below
STATIC_URL = '/static/'
# Template location
TEMPLATE_DIRS = (
os.path.join(os.path.dirname(BASE_DIR), "static", "templates"),
)
if DEBUG:
MEDIA_URL = '/media/'
STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static", "static")
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static", "media")
STATICFILES_DIRS = (
os.path.join(os.path.dirname(BASE_DIR), "static", "static"),
)
My urls.py below
urlpatterns = patterns('',
url(r'^/$', 'signups.views.home', name='home'),
url(r'^thank-you/$', 'signups.views.thankyou', name='thankyou'),
url(r'^about-us/$', 'signups.views.aboutus', name='aboutus'),
url(r'^customers/$', 'formlist.views.customers', name='customers'),
url(r'^addcustomer/$', 'formlist.views.addcustomer', name='addcustomer'),
url(r'^admin/', include(admin.site.urls)),
)
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL,
document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL,
document_root=settings.MEDIA_ROOT)
Currently i am at a loss to which setting to adjust to get the static files working with the alias in place, any suggestion would be very much appreciated. Please let me know if additional setup information is required to answer the question.
Setup:
Windows server 2012 64bit
WAMP
Apache 2.2
Python 2.7
Django 1.6
Bootstrap (latest)
regards.
Upvotes: 4
Views: 864
Reputation: 10553
Did you add the Alias for static in your httpd.conf ? Something like:
Alias /static/ D:\www\python\skillshare\static\static
<Directory D:\www\python\skillshare\static\static>
Options -Indexes FollowSymLinks
Order deny,allow
Allow from all
</Directory>
Upvotes: 3
Reputation: 3617
Great, I had to remove the / to get it to work, but it worked!
Alias /static D:\www\python\skillshare\static\static
<Directory D:\www\python\skillshare\static\static>
Options -Indexes FollowSymLinks
Order deny,allow
Allow from all
</Directory>
Upvotes: 1