Mezzanine Setup

[edited by admin -- there are some updated instructions here]

This is just a note for anyone who wants to set up Django/Mezzanine on Pythonanywhere.
Here are the steps I used:

  1. Create a mezzanine project mezzanine-project some_project_name

  2. Change directory to the project cd some_project_name

  3. Create a database python createdb

  4. Move all the static stuff (CSS, Javascript, etc.) to the static folder python collectstatic

  5. Change directory to /var/www cd /var/www

  6. Create a static directory (you should have /var/www/static mkdir static && cd static

  7. Copy all of your projects static stuff over to /var/www/static cp -r ~/some_project_name/static /var/www/static (or you can just use ".")

That's all she wrote folks!

To the Pythonanywhere folks, please correct any errors you may find here. Or, if you object to this procedure, then let me know.

Au Revoir Dave Capuano

Thanks for writing that up and sharing dscapuano, much appreciated. Mezzanine looks like the best CMS built on top of django out there at the moment.

@dscapuano: It's great to have you aboard. Thanks for hitting the ground running and helping out the community!!


Q: Why did the engineer quit his job?

A: Because he didn't get arrays!

One thing I'd recommend doing here is using MySQL instead of the sqlite database that Mezzanine uses by default. To do that, before starting dscapuano's instructions:

  • Visit the "MySQL" tab from your dashboard.
  • If you already have a database and password set up, then copy down the details of the one to use.
  • If you don't, enter a MySQL password then copy down the details of the default database

Next, after dscapuano's step 2 but before step 3, edit the file (not inside your newly-created and set the ENGINE to django.db.backends.mysql, the NAME to the MySQL database you want to use (eg. giles$default), the USER to your MySQL username (which is normally your PythonAnywhere username, though it will be truncated to 16 characters), the PASSWORD to the MySQL password you set up (not your PythonAnywhere login password), the HOST to mysql.server, and leave the PORT empty.

Then continue as per dscapuano's instructions. Doing it this way should make your site somewhat faster, as MySQL on a dedicated server is faster than sqlite, especially when (as in PythonAnywhere) the sqlite database file is on a remote disk.

hi guys,

okay so i just did the instructions, some quick questions. 1. where are the templates? i want to play with them 2. how do i preview the site?

@eakDev, the instructions in the FP assume that you've already set up a Django web app. We have a tutorial for that. If you only want mezzanine, you can skip out quite a lot of the tutorial. Just follow it until you have created a base Django web app and then follow @dscapuano's and @giles's instructions.

@Glenn I think that link will help me. Nice!!! Be reading it after work. Thanks a lot!!! Suggesttion: would it be great if PA includes mezzanine as one of the default options? :)

hello Guys,

okay so this is what i did. 1. follow the instructions on the link given by @glenn - to create a basic django installation 2. followed @giles instruction on setting the mysql database 3. then the instructions by @dscapuano.

after doing phase one, i checked my url and it showed the "It worked". but after doing phase 2 and 3, it showed the same "It worked" while i was expecting the default welcome page of mezzanine. ANY HELP?

also: 1. During "python createdb" should i choose the "" or the "" 2. Doing step 6 and 7 of @dscapuano instruction will do this: "/var/www/static/static/" is this normal or should it be "/var/www/static" only?

Thanks for the help.

Hi @eakDev -- taking your points one-by-one:

after doing phase one, i checked my url and it showed the "It worked". but after doing phase 2 and 3, it showed the same "It worked" while i was expecting the default welcome page of mezzanine. ANY HELP?

My guess is that you'd not restarted your web app at that point -- does that sound plausible? I see that your site seems to be serving Mezzanine now, though there is an error showing -- is that because you're working on something, or have you hit a new problem?

During "python createdb" should i choose the "" or the "" (without the www.) sounds like the best bet; definitely won't work.

Doing step 6 and 7 of @dscapuano instruction will do this: "/var/www/static/static/" is this normal or should it be "/var/www/static" only?

Actually, that's a bit out of date now. Instead of doing the cp command that @dscapuano suggests, go to the tab for your web app, and add a "Static file directory" mapping saying that the URL /static should map to /home/YOURUSERNAME/YOURPROJECTNAME/static. That will mean that all of your static files will be served up much faster.

Hi @giles -- thank you for taking time to answer my questions. I will have to do everything again for the purpose of getting used to the procedures. (besides i have been on field for almost a week already, don't remember everything). I will note the procedures i will be doing and maybe show you guys, that way you can correct where i did wrong. Hope that's ok.

Thanks again!!!

Another good candidate for our new (if we end up going this direction) merge to wiki button.

hi i'm having problems with the deployment of mezzanine here on pythonanywhere, when i try to load my page ( it says "Unhandled Exception". i've followed @dscapuano's instructions from 1 to 4 then followed @giles updated recommendations next. i've also reloaded the web app. any ideas?

What do your error logs say?

made some changes, now the traceback is displayed: i don't understand the AttributeError tho.

Hi usbong, it looks like the new version of Mezzanine is not compatible with the installed version of Django. You'll need to create a virtualenv. There are ([some instructions here]. Rather than installing Django though, just install mezzanine with pip install -U mezzanine.

thanks, also figured that out as well. my bad for not coming back here to update you but still, thank you :)

Thanks for letting us know!

I've been trying to put together some updated instructions. Check them out here: