Django/Python Beginner: Error when executing python manage.py syncdb – psycopg2 not found

There seems to be a problem with your psycopg2 installation – Python does not find it. This is a Python installation problem, not a Django issue. You can try to load it manually using the Python interpreter and see if it works: $ python >>> import psycopg2 If you get an ImportError exception, your installation … Read more

In django, how do I call the subcommand ‘syncdb’ from the initialization script?

All Django management commands can be accessed programmatically: from django.core.management import call_command call_command(‘syncdb’, interactive=True) Ideally you’d use a pre-init signal on runserver to activate this, but such a signal doesn’t exist. So, actually, the way I’d handle this if I were you would be to create a custom management command, like runserver_newdb, and execute this … Read more

Can I use a database view as a model in Django?

Just an update for those who’ll encounter this question (from Google or whatever else)… Currently Django has a simple “proper way” to define model without managing database tables: Options.managed Defaults to True, meaning Django will create the appropriate database tables in syncdb and remove them as part of a reset management command. That is, Django … Read more

Automatically create an admin user when running Django’s ./manage.py syncdb

I know the question has been answered already but … A Much simpler approach is to dump the auth module data into a json file once the superuser has been created: ./manage.py dumpdata –indent=2 auth > initial_data.json You can also dump the sessions data: ./manage.py dumpdata –indent=2 sessions You can then append the session info … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)