English 中文(简体)
How painful is a django project deployment to a live (staging) site? [closed]
原标题:
Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 8 years ago.

I ve getting quite fast with a small django project of mine, which I m developing locally, of course. But, as I had never worked with django before, I m not aware of what it implies to upload it and test it on a production server. And I m quite curious, since I m very eager to test an early release live.

I know there is this document, which I think it ll be really helpful: http://djangobook.com/en/2.0/chapter12/

But, are there any details I should take into account before, during and after the deployment? Any advice or best practices?

Thanks.

最佳回答

Make your development/testing environment match your deployment environment as closely as possible. This means using e.g. PostgreSQL and mod_wsgi instead of SQLite and the built-in server. This software is free so there s no reason you can t get your hands on it.

问题回答

Use something like south to remove database migration pains, and consider something like buildout or fabric for deployment if you have a reasonably complex project (or have the time to learn these tools), as they will allow easily reproducible scripted deployments.

You might run into problems if you serve your site on a subdirectory of a domain: avoid writing absolute urls by hand, use the url tag instead.

If you rely on initial data in the database, use fixtures.

If your server will be used for multiple sites, consider packaging your site with Virtualenv to avoid dependencies conflicts with the other sites.

You should also use the same database system in your dev and production servers to avoid surprises.

I think a lot hangs on the change of the database model. Django can add new columns with syncdb, or generate a script to do that, but it will not remove columns and I don t think it will remove foreign key constraints from the database even if they do not apply anymore.

So database migration might be best done scripted, and tested on a copy of the production database or some data set closely resembling production data (the same schema of course).





相关问题
How to get two random records with Django

How do I get two distinct random records using Django? I ve seen questions about how to get one but I need to get two random records and they must differ.

Moving (very old) Zope/Plone Site to Django

I am ask to move data from a (now offline) site driven by Plone to a new Django site. These are the version informations I have: Zope Version (unreleased version, python 2.1.3 ) Python Version 2.1....

Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

Flexible pagination in Django

I d like to implement pagination such that I can allow the user to choose the number of records per page such as 10, 25, 50 etc. How should I go about this? Is there an app I can add onto my project ...

is it convenient to urlencode all next parameters? - django

While writing code, it is pretty common to request a page with an appended "next" query string argument. For instance, in the following template code next points back to the page the user is on: &...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

热门标签