Friday, August 1, 2014

Re: Changing website version written in python+django

On 08/01/2014 01:06 AM, Zoltán Turcsányi wrote:
> Hi Everyone,
>
>
> I have a website written in python+django and I deployed it to
> pythonanywhere.com. It's okay, works well, but I want to deploy new
> versions. How should I do that?
> Just copy the new files with rsync? Or change the full django project
> directory?
> I would be really grateful if you wrote it step by step.

Hi Zoli,

I'm assuming that you're not using virtualenv right now. The best way to
do this is to use virtualenv, virtualenwrapper, and a revision control
system like Mercurial. The workflow goes something like this.

mkvirtualenv new_site
# pip install (all the bits that make up your site with the versions
that you want)
# hg clone (/path/to/old_site)
# run automated tests
# cd (to wherever manage.py is)
python manage.py runserver

That will enable you to test the upgraded site without any risk of
breaking the currently working site. Once you're satisfied that it's
working as you expect, you can "pip freeze > requirements.txt" and use
that as the basis of seeding an installation on the production server.
Again, use virtualenv on the server so that you can isolate the
environment for your site from the system-wide site-packages.

We have a site we built using Mezzanine 3.0.9. It pulled in Django 1.6.2
as a dependency when we did "pip install Mezzanine". In a test
virtualenv, we duplicated the production virtualenv so we had Mezzanine
3.0.9 and all its dependencies. We then ran "pip install --upgrade
Mezzanine" and that pulled in Mezzanine 3.1.9 with Django 1.6.5.
Immediately, we noticed there was some breakage on the site we built. We
downgraded to Mezzanine 3.0.9 in the test environment while leaving
Django 1.6.5 alone and that breakage disappeared so it's clear that it's
not Django but Mezzanine at the source of the breakage.

We upgraded Django to 1.6.5 in the production environment while leaving
Mezzanine at 3.0.9 and we'll have to deal with the breakage of our site
with Mezzanine 3.1.9 in the test environment before we can upgrade
Mezzanine in production, too. If we weren't using virtualenv, that would
have been an ordeal.

--
Regards,

Clifford Ilkay

647-778-8696

Dinamis

<http://dinamis.com>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/53DBBF1B.5020108%40dinamis.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment