简体   繁体   中英

How do I make changes to a Django Model after it has been deployed to a webserver?

In development, whenever I make changes to the underlying model in my Django application, I'm used to:

  1. Stopping the development server
  2. In MySql, dropping the existing database
  3. running $>python manage.py syncdb
  4. Restarting the development server by running $>python manage.py runserver

Once deployed using WSGI & Apache, however, I don't have the development server running. As such, I don't know how to stop the server, and just running:

$>python manage.py syncdb

didn't appear to update the underlying MySql database that instantiates the model. So, short of tearing down the entire instance, how do I update my database?

Note: I implemented this before I learned about db migrations using "south" so I'm looking at raw Django, I suspect.

Django doesn't have a migration framework built-in (yet!), so there's no such thing as "raw django for migrations".

Consequently, you either do that manually (using SQL to alter the table), or you use south.

Now, my recommendation would be to use south .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM