Mezzanine under url prefix

278 views
Skip to first unread message

Eduardo Rivas

unread,
Feb 14, 2013, 8:06:27 PM2/14/13
to mezzani...@googlegroups.com
Hello, I'm in need of deploying a Mezzanine site under a URL prefix, let's say example.com/somepage. The domain connects to a server already running Wordpress, and Mezzanine most only live in this subpage.

I think the question goes beyond the scope of this group, but I'm hoping someone else has already done something like this:
  • The domain is not owned by me, and I don't have control over it. Is it possible for the managers of the other server to redirect example.com/somepage to the Django instance in my server, preserving the url?
  • Is Mezzanine ready to run this way? Is it as simple as defining SITE_PREFIX?

Thanks in advance!

Stephen McDonald

unread,
Feb 14, 2013, 8:53:33 PM2/14/13
to mezzani...@googlegroups.com
Should generally work.

On Fri, Feb 15, 2013 at 12:06 PM, Eduardo Rivas <jeriva...@gmail.com> wrote:
Hello, I'm in need of deploying a Mezzanine site under a URL prefix, let's say example.com/somepage. The domain connects to a server already running Wordpress, and Mezzanine most only live in this subpage.

I think the question goes beyond the scope of this group, but I'm hoping someone else has already done something like this:
  • The domain is not owned by me, and I don't have control over it. Is it possible for the managers of the other server to redirect example.com/somepage to the Django instance in my server, preserving the url?
They should be able to configure the web server to proxy to the django app
 
  • Is Mezzanine ready to run this way? Is it as simple as defining SITE_PREFIX?

That's the intention.
 

Thanks in advance!

--
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-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Stephen McDonald
http://jupo.org

Scott Diehl

unread,
May 15, 2014, 8:12:06 PM5/15/14
to mezzani...@googlegroups.com, st...@jupo.org
I have a question in regards to this topic as well.

I need to move our website under a site prefix (long story) - I have defined the site prefix in settings.py and have made the necessary changes in urls.py as well. The pages of the site are all working under the prefix.

However, is there a way to also move admin portion of mezzanine behind the prefix as well? Is it just a matter of moving things around in the template files?

thanks,

Scott

Josh Cartmell

unread,
May 16, 2014, 9:41:42 AM5/16/14
to mezzani...@googlegroups.com
Hey Scott, I could be wrong, but I think you could do that by opening your project's urls.py and just changing the url that the admin is registered under.  Currently you should have something like:
("^admin/", include(admin.site.urls)),

 You could change it to:

("^whatever-prefix/admin/", include(admin.site.urls)),


For more options, visit https://groups.google.com/d/optout.

Scott Diehl

unread,
May 16, 2014, 11:22:54 AM5/16/14
to mezzani...@googlegroups.com
Of course! Thank you. Worked like a charm.

Scott Diehl

unread,
May 19, 2014, 6:39:42 PM5/19/14
to mezzani...@googlegroups.com
Hey Josh, 

The prefix ('home') is working for all my page URLs and admin dashboard. However, I've found a couple errors (I think they are related)
  • When creating a new page, or editing a page, the "save" button doesn't do anything - I can see it is throwing a 404 in the console. If I remove the prefix, this works again... 
    POST http://127.0.0.1:8000/home/admin_keywords_submit/ 404 (NOT FOUND)
  • The "password_reset" link on login page isn't working - if I remove the prefix it works.
Any ideas?

I'm wondering if there is a problem with how my template files are structured maybe?

thanks,
Scott

On Friday, May 16, 2014 6:41:42 AM UTC-7, Josh Cartmell wrote:

Josh Cartmell

unread,
May 20, 2014, 9:47:10 AM5/20/14
to mezzani...@googlegroups.com
Hey Scott, sorry but I honestly have no idea.  I've never run Mezzanine under a different prefix.  I have moved the admin to a prefix before which is why I knew that one.  I would just dig into the Mezzanine URL's and see if it looks like something is off with the admin keywords submit.

Scott Diehl

unread,
May 20, 2014, 4:14:23 PM5/20/14
to mezzani...@googlegroups.com
No problem, I appreciate all your help. 

This is a weird one...because basically I am unable to add/edit pages when I have the prefix enabled. I've followed the directions outlined in urls.py - and everything else seems to be working as expected.

Scott

Scott Diehl

unread,
May 21, 2014, 4:30:51 PM5/21/14
to mezzani...@googlegroups.com
Sorry to bother on this one, just want to see if some new info will help diagnose the potential causes...

I updated, and then did a fresh install of mezzanine and got the example site running. Only change I've made is adding the prefix (note: did not change the admin prefix). Again, all the pages are working with prefix...

Problems arise in the admin dashboard: 
  • The Media Library "Select Files" button swf object disappears with prefix enabled: "/prefix/asset_proxy/?u=/static/filebrowser/uploadify/uploadify.swf"
  • Saving pages or Blogs throws a 404: "POST http://127.0.0.1:8000/prefix/admin_keywords_submit/ 404 (NOT FOUND)"
I'm going to keep digging, but maybe someone else could test this. Any help is very appreciated, as always!

thank you,

Scott

Josh Cartmell

unread,
May 22, 2014, 9:49:24 AM5/22/14
to mezzani...@googlegroups.com
Hey Scott, I just gave it a shot and both of those things work for me with a prefix enabled.  Here are the steps I took (starting with creating a fresh virtualenv):

virtualenv TESENV
source TESENV/bin/activate
pip install mezzanine
mezzanine-project proj
cd proj/
# edit the project's urls, import settings at the top and uncomment the prefix url pattern, comment out the normal one
# add SITE_PREFIX to settings.py
python manage.py createdb --noinput
python manage.py runserver

When you browsed the fresh project did you hard refresh your browser?  I know mine tends to get confused since I'm browsing different sites on local host and will sometimes pick up js/css from a previous site I had been developing.

Scott Diehl

unread,
May 22, 2014, 3:29:55 PM5/22/14
to mezzani...@googlegroups.com
Josh! I wish I could buy you a beer. I got it figured out. Thank you for writing out your steps. Of course it was something ridiculously simple...I was forgetting to comment out the normal url pattern. *facepalm

I am so thankful that this prefix feature was added to the settings...exactly what we needed. Got everything working. I love Mezzanine.

Thanks again

Josh Cartmell

unread,
May 22, 2014, 4:41:35 PM5/22/14
to mezzani...@googlegroups.com
Glad you got it and cheers, maybe someday!
Reply all
Reply to author
Forward
0 new messages