How to run django database migrations with PTVS?

Oct 29, 2014 at 9:21 AM
How can I execute the database migration commands using PTVS? In particular those:

https://docs.djangoproject.com/en/1.7/topics/migrations/

Do I need an external shell for this or is there a way of doing it from the IDE?
Coordinator
Oct 30, 2014 at 9:08 PM
We haven't created commands that wrap every django manage.py parameter, but it's possible to add new ones.

If you look at Microsoft.PythonTools.Django.targets (in C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Python Tools), this is where we define the existing commands for "Django Sync DB", "Collect Static Files", etc.

You can search for DjangoSyncDbCommand for an example.
Coordinator
Oct 30, 2014 at 9:10 PM
Note also that it is possible to add such commands directly to your .pyproj file in the same manner, instead of editing .targets. This way, other people opening your project will also get the commands.

You can also create your own .targets file and import it from .pyproj.
Nov 17, 2014 at 3:15 AM
For those who are interested, this is what my .targets file looks like:

Custom Django Targets

Where do I define the labels?
Coordinator
Nov 17, 2014 at 5:53 PM
It's Target/@Label. If you don't use the "resource:..." syntax, the text itself will be the label.
May 1, 2015 at 5:49 PM
housemate were you able to get this to work? I've been trying to get migrations working with no success. I borrowed your code as posted above and now the makemigrations command will work but it doesn't find any migrations. Any help would be appreciated.