简体   繁体   中英

shell with django environment in eclipse,pydev giving syntax error

``>>>python manage.py syncdb  

 File "<console>", line 1  
python manage.py syncdb
SyntaxError: invalid syntax  
            ^``

What could the problem be?

Extra Info if it might help -
Python - 2.6
Django - 1.2.5
Eclipse - 3.6.0
Pydev - 1.6.5

It seems you're in a python shell already, so that command won't work. You would have to use that from the command line in the project folder.

In this question you'll find how to run syncdb from the python shell.

Yeah, @chris is right, your trying to run a file with a Python interpreter from within an interactive shell.

If you add Django ( org.python.pydev.django.djangoNature ) to the list of your project natures, you can then right click on your project in the resources view and you then have the Django submenu from where you can run a custom manage.py command and other commands such as sycdb , test , etc. from the list of entries.

If you want to store a custom command which would be an equivalent to, say, manage.py test myapp1, myapp2 you then create a custom run configuration. Basically, you specify your current project as the "Project", manage.py as the "Main module" and then write "test myapp1, myapp2" as the argument for manage.py .

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