Hi Jared,

"Am I wrong to think that I can run my Mezzanine project with a development
server?" Don't do this. Use Gunicorn.

I deploy my stuff to Amazon, but I suspect that Digital Ocean would be the
same. Actually, if you have SSH access it will be the same.

What I follow is this blog post and it works like a charm
http://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/

The only change I ever make in the setup is "bind=unix:$SOCKFILE" inside
gunicorn_start file. I bind it to the actual address like this:

ADDRESS=127.0.0.1:8001

bind=$ADDRESS

As for the fab file, mine looks like this:

def deploy_migrate_restart():
    local("pip freeze > requirements.txt")
    local("hg pull ssh://[email protected]/YOUR_REPO; hg update")
    local("hg addremove; hg commit; hg push --verbose --debug --traceback
ssh://[email protected]/YOUR_REPO")
    with prefix('source PATH_TO_VENV/bin/activate'):
        run("cd PROJECT_PATH; hg pull ssh://[email protected]/YOUR_REPO; hg
update")
        run("sudo pip install -r PROJECT_PATH t/requirements.txt")
        run("python PROJECT_PATH/manage.py migrate")
        run("python PROJECT_PATH/manage.py collectstatic --noinput")
        run("sudo PROJECT_PATH/restart-gunicorn")

Obviously you need to replace things like PROJECT_PATH with path to your
project but this simple script works for me. "restart-gunicorn" contains
one line:

sudo supervisorctl restart YOUR_PROJECT

Anyway, I'd recommend you to take these steps:

- Setup DB etc so that when you run runserver inside shell it doesn't throw
any errors.
- Setup nginx to rout / to localhost:8001 and then run runserver and make
sure you can access it from an external IP
- Setup gunicorn so that it runs in the shell, doesn't throw errors and
it's listening for requests. You should be able to access for external IP.
- Setup supervisor to run Gunicorn processes for you.

That's usually the process I go through and it works quite well.

I hope that helps!

Cheers,

M





On Mon, Apr 28, 2014 at 12:58 PM, Jared Nielsen <[email protected]>wrote:

> Everything about Mezzanine is awesome. Except deployment.
> I'm new to Mezzanine and Django and struggling to get my site deployed.
> I chose Digital Ocean because for their price, their documentation and
> Josh's fab post:
> http://bitofpixels.com/blog/deploying-mezzanine-to-digital-ocean-using-the-included-fabfile/
>
> I'm attempting two approaches.
> 1. The first is following the Digital Ocean guidelines, beginning with
> this tutorial:
>
> https://www.digitalocean.com/community/articles/how-to-install-and-get-started-with-django-based-mezzanine-cms-on-ubuntu
>
> I create a droplet, login, create a virtualenv, pip install mezzanine and
> pillow, mezzanine-project, createdb, runserver like this: python manage.py
> runserver 0.0.0.0:8000
> No problem. Fresh Mezzanine project in my browser.
>
> So I create a new virtualenv and directory, git clone my mezzanine
> project, install requirements, runserver:
>
> django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must
>> not be empty.
>>
>
> So I create a local_settings.py file and add a SECRET_KEY.
>
> Then runserver, and I get this error at http://<my_droplet>:8000
>
>> Bad Request (400)
>
>
> Am I wrong to think that I can run my Mezzanine project with a development
> server?
>
>
> Moving on...
>
> 2. Following Josh's tutorial:
> http://bitofpixels.com/blog/deploying-mezzanine-to-digital-ocean-using-the-included-fabfile/
>
> I fill in all my settings and when I run fab all, I get:
>
> [jarednielsen.com] Executing task 'all'
>>
>> ---
>> all
>> ---
>>
>>
>> -------
>> install
>> -------
>>
>>
>> $ cat /etc/default/locale ->
>>
>> [jarednielsen.com] Login password for 'jarednielsen':
>>
>
> I enter my password and it times out for a moment, then asks for my
> password again and again.
>
> What am I missing here?
>
> Many 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Mario Gudelj
M: 0415 193775

www.twoblokeswithapostie.com - Talk to us before you tell your clients:
"No, Business Catalyst can't do that."

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to