Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCharm discovering new core Django (rather than app) manage.py tasks?

I'm hoping to use a newer Django (1.7.dev) inside PyCharm 2.7.3... so it's the only Django version installed in my project's virtualenv.

But, the "Tools" -> "Run manage.py task" list isn't discovering the new commands included in Django itself, like migrate or makemigrations. (Based on prior experience with apps like South, I'd hoped all available tasks would be auto-discovered.)

Is there a way to help PyCharm 2.7.3 discover and use these new options?

like image 435
gojomo Avatar asked Nov 11 '22 14:11

gojomo


1 Answers

the "Tools" -> "Run manage.py task" doesn't see the makemigration or migrate argument.

You can run manage.py with right click on manage.py file in you project.

with this output:

*

*Usage: manage.py subcommand [options] [args]
Options:
  -v VERBOSITY, --verbosity=VERBOSITY
                        Verbosity level; 0=minimal output, 1=normal output,
                        2=verbose output, 3=very verbose output
  --settings=SETTINGS   The Python path to a settings module, e.g.
                        "myproject.settings.main". If this isn't provided, the
                        DJANGO_SETTINGS_MODULE environment variable will be
                        used.
  --pythonpath=PYTHONPATH
                        A directory to add to the Python path, e.g.
                        "/home/djangoprojects/myproject".
  --traceback           Raise on exception
  --no-color            Don't colorize the command output.
  --version             show program's version number and exit
  -h, --help            show this help message and exit
Type 'manage.py help <subcommand>' for help on a specific subcommand.
Available subcommands:
[auth]
    changepassword
    createsuperuser
[django]
    check
    compilemessages
    createcachetable
    dbshell
    diffsettings
    dumpdata
    flush
    inspectdb
    loaddata
    makemessages
    makemigrations
    migrate
    runfcgi
    shell
    sql
    sqlall
    sqlclear
    sqlcustom
    sqldropindexes
    sqlflush
    sqlindexes
    sqlinitialdata
    sqlmigrate
    sqlsequencereset
    squashmigrations
    startapp
    startproject
    syncdb
    test
    testserver
    validate
[sessions]
    clearsessions
[staticfiles]
    collectstatic
    findstatic
    runserver*

*

As you can see "makemigrations" and "migrate" are in the available subcommands for django

So you have to "Run" - > "Edit Configurations" and add "makemigrations" or "migrate" in the script parameters

Now run the script and it works

like image 87
luca Avatar answered Nov 15 '22 06:11

luca