I ran into a problem while going through my first Django tutorial.
I didn't create an initial superuser account during syncdb and I'm now trying to create it programmatically. The problem is that I'm getting an invalid syntax error when I run the command:
>>> django-admin.py createsuperuser
File "<stdin>", line 1
django-admin.py createsuperuser
^
SyntaxError: invalid syntax
I am running Django through Python tools for Visual Studio 2010. Both 'django.contrib.auth' and 'django.contrib.admin' are enabled in settings.py. Here is the tutorial that I'm following.
Looks like you are running the command in the django shell
. You need to run this command in the command prompt/terminal instead.
Demo
(_env)k@dev:~/workspace/prj krav 48 $ ./manage.py shell
In [1]: manage.py createsuperuser
------------------------------------------------------------
File "<ipython console>", line 1
manage.py createsuperuser
^
SyntaxError: invalid syntax
Continued..
In [2]: exit()
Do you really want to exit ([y]/n)? y
(_env)k@dev:~/workspace/prj krav 48 $ ./manage.py createsuperuser
Username: