Hi There, I've managed to build a site using Mezzanine and it's time to deploy to a web server, but I'm running into some strange issues when my site is running via WSGI versus the "manage.py runserver" command I have been using in development. I am using uWSGI and have Apache 2.4 configured to serve static files and proxy everything else to uWSGI. I am able to navigate to the front page of my site with these configurations: ==mysite-wsgi.ini== [uwsgi] pidfile = /tmp/mysite-socket.pid daemonize = /tmp/uwsgi.log scgi-socket = 127.0.0.1:2000 pythonpath = /var/www/mysite/mysite wsgi-file = /var/www/mysite/mysite/wsgi.py chdir = /var/www/mysite master = true processes = 4 threads = 2 uid = daemon gid = daemon virtualenv = /opt/venv/mysite stats = 127.0.0.1:9191 env= DJANGO_SETTINGS_MODULE=mysite.settings ==httpd/conf.d/mysite.conf== <VirtualHost *:80> ServerName mysite
DocumentRoot /var/www/mysite Alias /robots.txt /var/www/mysite/static/robots.txt Alias /favicon.ico /var/www/mysite/static/img/favicon.ico <Location /> ProxyPass scgi://127.0.0.1:2000/ </Location> <Location /static/> ProxyPass ! </Location> ProxyPass /robots.txt ! ProxyPass /favicon.ico ! </VirtualHost> Static files are served which leads me to believe that mysite.conf is working correctly. Requests that don't match any of the ProxyPass overrides are sent to uWSGI which generates the response and sends a 200 code back to Apache, *regardless if this is a valid URL for the site*. The body of the response is *always *the front page template I have made, which leads me to believe this is an issue with my urls.py: ==urls.py== urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'^$', direct_to_template, {"template": "index.html"}, name= "home"), url(r'^', include("mezzanine.urls")) ] handler404 = "mezzanine.core.views.page_not_found" handler500 = "mezzanine.core.views.server_error" Strangely, I can't even navigate to the admin interface, which ought to be evaluated before the case for the homepage, When ran through 'manage.py runserver', I am able to navigate to the admin interface and all other pages on the site normally. My next troubleshooting step was to set up a debugger to see if Apahce or uWSGI was misbehaving. Code for this is below: import os from werkzeug import DebuggedApplication, run_simple from django.core.wsgi import get_wsgi_application from mezzanine.utils.conf import real_project_name os.environ.setdefault("DJANGO_SETTINGS_MODULE", "%s.settings" % real_project_name("mysite")) application = DebuggedApplication(get_wsgi_application(), evalex=True) run_simple('localhost', 4000, application) #application = get_wsgi_application() This allows me to make HTTP requests directly to the running uWSGI processes on port 4000. Using the same configuration as above, I am able to make requests to the admin interface and pages that would be evaluated by the 'mezzanine.urls' pattern, just like I am able to when using 'manage.py runserver'. Doing a little research leads me to this: http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html which describes some disparities between how runserver sets up the django/mezzanine environment vs. how a WSGI app would start. However, I wasn't able to create a working solution based on the code and explanation provided. Does anyone have an idea what's going on here? I'm just about at my wits end on this one; Any help will be greatly appreciated! TL;DR: My urls.py urlpatterns rules behave differently when the app is served through 'manage.py runserver' vs. through the httpd24/uWSGI configuration I have posted above. Cheers! -- You received this message because you are subscribed to the Google Groups "Mezzanine Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.