rikho / munki

Automatically exported from code.google.com/p/munki
Other
0 stars 0 forks source link

munkiwebadmin static pages not loading #201

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

What steps will reproduce the problem?
1. Install per documentation
2. urls.py is missing static files ref

Updated the urls.py per the django doc and all is well. 

https://docs.djangoproject.com/en/dev/howto/static-files/

Original issue reported on code.google.com by spankens...@gmail.com on 18 Sep 2012 at 2:47

GoogleCodeExporter commented 9 years ago
I don't think there is an issue here.

Serving static files with a Django app has several possible solutions. If you 
follow the demo setups for OS X and for Linux, each takes a different approach. 
There are other approaches as well. In fact, there are may other ways to 
successfully deploy Django apps -- documentation here cannot cover them all, 
not should it attempt to.

If you'd provide more information about what you did, what you expected, and 
what changes you made to meet your expectations we could see if this might be 
something to add to the documentation.

Original comment by gregnea...@mac.com on 18 Sep 2012 at 3:47

GoogleCodeExporter commented 9 years ago
I installed munkiwebadmin on Lion Server and Mountain Lion server per the 
documentation. The only thing that did not work properly were the static files. 
They error with 404. Not a huge deal, but I expected the cool looking 
interface. Maybe this is only an issue on the server OS? I am not sure as I 
have not loaded it on a standard Lion or Mountain Lion install. As you said, I 
am sure there are several ways to fix this, but I just updated the urls.py

If this is not an issue with a standard OS install, then hopefully this comment 
will provide a quick answer for the Server OS folks out there. 

Here is my updated urls.py:

from django.conf.urls.defaults import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Uncomment the admin/doc line below to enable admin documentation:
     url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),

    url(r'^login/$', 'django.contrib.auth.views.login'),
    url(r'^logout/$', 'django.contrib.auth.views.logout_then_login'),
    url(r'^manifest/', include('manifests.urls')),
    url(r'^catalog/', include('catalogs.urls')),
    url(r'^report/', include('reports.urls')),
    url(r'^inventory/', include('inventory.urls')),
    # for compatibility with MunkiReport scripts
    url(r'^update/', include('reports.urls')),
    url(r'^lookup/', include('reports.urls')),
    url(r'^$', include('reports.urls')),
)
urlpatterns += staticfiles_urlpatterns()

Original comment by spankens...@gmail.com on 18 Sep 2012 at 4:09

GoogleCodeExporter commented 9 years ago
It sounds like you might have missed the step where you run

python manage.py collectstatic 

To stage the static files under /static, which allows the django_wsgiserver 
process to serve them.

But your solution is fine as well.

Original comment by gregnea...@mac.com on 18 Sep 2012 at 4:17

GoogleCodeExporter commented 9 years ago
Nope, while I was digging around to find the issue, I checked the static files. 
I re-installed the whole thing from scratch, and repopulated the static/ 
directories with "python manage.py collectstatic". They were populated as 
expected from the documentation.  As soon as I added that entry to the urls 
though, I was good to go.. 

When running djando in debug mode, I could see that it was denying access to 
the static files. 

[18/Sep/2012 09:19:11] "GET 
/catalog/static/css/smoothness/jquery-ui-1.8.16.custom.css HTTP/1.1" 404 3013
[18/Sep/2012 09:19:11] "GET /catalog/static/css/bootstrap-responsive.min.css 
HTTP/1.1" 404 3013
[18/Sep/2012 09:19:11] "GET /catalog/static/css/bootstrap.min.css HTTP/1.1" 404 
3013
[18/Sep/2012 09:19:11] "GET /catalog/static/css/datatables-bootstrap.css 
HTTP/1.1" 404 3013
[18/Sep/2012 09:19:11] "GET /catalog/static/js/jquery-1.7.2.min.js HTTP/1.1" 
404 3013

Original comment by spankens...@gmail.com on 18 Sep 2012 at 6:49

GoogleCodeExporter commented 9 years ago
No-one else who has used the setup guides has reported a similar issue, though, 
so I'm not yet convinced there _is_ an issue to be addressed within the MWA 
files or documentation.

Original comment by gregnea...@mac.com on 18 Sep 2012 at 6:52

GoogleCodeExporter commented 9 years ago
Closing issue since we have not been able to reproduce and there has been no 
further information in two months.

Original comment by gregnea...@mac.com on 10 Nov 2012 at 5:17

GoogleCodeExporter commented 9 years ago
For what it's worth, this just happened to me on my 10.8.3 machine.  Using the 
urls.py in comment #2 solved the issue.

Original comment by mcn...@povertyactionlab.org on 6 Jun 2013 at 1:27

GoogleCodeExporter commented 9 years ago
My experience was the same as comment #2, in Lion Server 10.7.5 even after 
collecting the static files a few times, I had to modify urls.py in order to 
load the pretty CSS.

Original comment by brad.kah...@d214.org on 20 Jun 2013 at 2:23

GoogleCodeExporter commented 9 years ago
The urls.py from comment #2 solved the issue on my installation of 10.8.4.  I 
followed the "Setting up MunkiWebAdmin on OS X" instructions twice, removing 
and starting again with a new virtual environment in between, before I started 
searching and found this solution.
Besides 10.8.4, I have Server.app 2.2.1 and the Command Line Tools (OS X 
Mountain Lion) for Xcode 5 July 2013 installed.

Original comment by hilda...@gmail.com on 9 Jul 2013 at 8:08

GoogleCodeExporter commented 9 years ago
This appears to be caused by a version of django-wsgiserver newer than the one 
that was available when the setup guide was written.

I've updated the urls.py and the setup guide to work with the (now) current 
Django and django-wsgiserver.

Original comment by gregnea...@mac.com on 11 Jul 2013 at 4:51