Manage.py : Unknown command: 'migrate' - django

I'm using django and I'm facing a little problem. I would like to use the 'migrate' command with manage.py But when I try I get this error message:
Unknown command: 'migrate'
Type 'manage.py help' for usage.
I have south installed (I installed it with pip), but I still can't use this command. I don't know what to do.
Thank you for your help!

You have to include south in INSTALLED_APPS in your settings.py.

This is likely caused by following the 1.7 (DEV version) tutorial when we all get the last stable version (1.6) installed by pip.
It would not appear migrate is even a part of 1.7 in general!
Maybe the following command solve your problem: python manage.py syncdb
So either follow 1.6 tutorial or follow the instructions to install the 1.7 dev version of Django.

Related

django framework runserver not working

Django server isn't working on the command: python manage.py runserver (on providing the port number as well)
I'm using windows 8, the path is set in environment variables. I've tried re-installing both python and django but it didn't help.
I share the similar problem. I solved it by just running Python 2.7x.
While working with the runiserver
python manage.py runserver --noreload
also worked for me - at least for a while. Maybe install an older version of Django?
I've not literally found a solution...
however it worked when I used python 2.7.13 (this creates a folder where you've scripts, easy_install etc., but I couldn't find a folder "Python" when I was using Python 3.6.1)

"Unknown command syncdb" running "python manage.py syncdb"

I want to create the tables of one database called "database1.sqlite", so I run the command:
python manage.py syncdb
but when I execute the command I receive the following error:
Unknown command: 'syncdb'
Type 'manage.py help' for usage.
But when I run
manage.py help
I don`t see any command suspicious to substitute
python manage.py syncdb
Version of Python I use: 3.4.2 Version of Django I use:1.9
I would be very grateful if somebody could help me to solve this issue.
Regards and thanks in advance
If you look at the release notes for django 1.9, syncdb command is removed.
Please use migrate instead. Moving forward, the migration commands would be as documented here
Please note that the django-1.9 release is not stable as of today.
Edit: Django 1.9 is stable now
the new django 1.9 has removed "syncdb",
run "python manage.py migrate",
if you are trying to create a super user, run "python manage.py createsuperuser"
$python manage.py syncdb is deprecated and not supported now.
So instead of this follow below instructions..
Whatever model you have created:
First run:
$python manage.py makemigrations
After running this command you model will be reflected in a migration.
Then you have to run:
$python manage.py migrate
Then run server:
$python manage.py runserver
Now, your project will run perfectly.
In Django 1.9 onwards syncdb command is removed. So instead of use that one, you can use migrate command,eg: python manage.py migrate.Then you can run your server by python manage.py runserver command.
Django has removed python manage.py syncdb command now you can simply use python manage.py makemigrations followed bypython manage.py migrate. The database will sync automatically.
You can run the command from the project folder as: "python.exe manage.py migrate", from a commandline or in a batch-file.
You could also downgrade Django to an older version (before 1.9) if you really need syncdb.
For people trying to run Syncdb from Visual Studio 2015:
The option syncdb was removed from Django 1.9 (deprecated from 1.7), but this option is currently not updated in the context menu of VS2015.
Also, in case you didn't get asked to create a superuser you should manually run this command to create one: python.exe manage.py createsuperuser
Run the command python manage.py makemigratons,and than python manage.py migrate to sync.
Alternarte Way:
Uninstall Django Module from environment
Edit Requirements.txt a type Django<1.9
Run Install from Requirments option in the enviroment
Try Syncdb again
This worked for me.
I also tried this command. Lastly I found the release note from django
Features removed in 1.9
The syncdb command is removed.
Djnago Releases note 1.9
I had the same problem, the only thing worked for me was this command.
python3 manage.py migrate --run-syncdb
Running this got me this result.
Ranvijays-Mac:djangodemo rana.singh$ python3 manage.py migrate --run-syncdb
Operations to perform:
Synchronize unmigrated apps: messages, staticfiles
Apply all migrations: admin, auth, contenttypes, msg, sessions
Synchronizing apps without migrations:
Creating tables...
Running deferred SQL...
Running migrations:
Applying msg.0001_initial... OK

Pinax on Webfaction - manage.py syncdb not finding virtualenv

(pinax09)[user#web213 social]$ python manage.py syncdb
Error: Can't import Pinax. Make sure you are in a virtual environment that has
Pinax installed or create one with pinax-boot.py.
I'm obviously in pinax09 virtualenv which has pinax installed hence I could create a social project with setup_project. However, once I run the syncdb it complains it can't import Pinax. What could be the problem?
Might be a problem with Python versions - I've had that on Webfaction before. Try just ./manage.py syncdb, without the python, which should run the correct version.

Setting mod_wsgi, django python version

I'm having trouble setting up the correct python version for mod_wsgi / django setup.
After numerous bugs I think i'm nearing the end of this tedious setup... I'm trying to run a command from my manage.py file using ./manage.py collectstatic
This is failing because it's trying to use the Python 2.4 version (I have 2.7 installed as well), I believe the version error only occurs when i manually try and run manage. My django.wsgi file inserts the python 2.7 dir into sys.path
Thanks for your help
python2.7 manage.py collectstatic worked. Thanks to Display Name for the comment

nginx/wsgi/Virtualenv/pip/yolk/django configuration add new module

I'm having a small problem with my setup. I'm quite new to the Django world so bear with me.
A friend who is familiar has set up a VPS (Ubuntu) for my project.
I'm now on my own trying to add a new module (south) so I can use manage.py migrate
When the virtualenv was deactivated I installed the module
$ sudo pip -E /var/www/env/example.com install south
$ touch /var/www/sites/example.com.wsgi
$ source /var/www/env/example.com/bin/activate
It appeared to go fine
$ yolk -l
I see the south module.
at which point I run on my site
$ python manage.py syncdb
$ python manage.py migrate
I get this error though:
$ python manage.py migrate
Unknown command: 'migrate'
Type 'manage.py help' for usage.
I don't have a full understanding of what I'm doing but I'm willing to learn.
Maybe someone could point me in the right direction? Am I missing something?
You still have to add "south" to your INSTALLED_APPS list in your project's settings module. Django doesn't use south just because it is installed in the PYTHONPATH :-)
This has nothing to do with the rest of your server setup but just how you configure Django itself.