5

I want to Use PostgreSQl With Django . I referred this tutorial to install it and when I run this command

python manage.py syncdb

I get the following errors

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 453, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 272, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 77, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py", line 8, in <module>
    from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/sql.py", line 9, in <module>
    from django.db import models
  File "/usr/local/lib/python2.7/dist-packages/django/db/__init__.py", line 40, in <module>
    backend = load_backend(connection.settings_dict['ENGINE'])
  File "/usr/local/lib/python2.7/dist-packages/django/db/__init__.py", line 34, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 93, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 27, in load_backend
    return import_module('.base', backend_name)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py", line 14, in <module>
    from django.db.backends.postgresql_psycopg2.creation import DatabaseCreation
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/creation.py", line 1, in <module>
    import psycopg2.extensions
ImportError: No module named psycopg2.extensions

I also Saw this question and executed this

sudo apt-get build-dep python-psycopg2
pip install psycopg2 

However I still get the same error after doing this

Community
  • 1
  • 1
user2528042
  • 419
  • 2
  • 6
  • 12

1 Answers1

2

Ensure all packages being installed are being done so using sudo; otherwise, the installation will likely fail and you may not notice the error message indicating the failure was a result of permission issues.

Joseph Paetz
  • 876
  • 1
  • 7
  • 12
  • one more help , can you give me a link where I can get screen shots and code for django application dev. with some example and learn quickly as possible – user2528042 Sep 12 '13 at 16:04
  • 1
    I think the universal answer is to walk your way through the [Django tutorial](https://docs.djangoproject.com/en/1.5/#first-steps) and go from there. – Joseph Paetz Sep 12 '13 at 16:14
  • I find it to be a bit slow and also they dont take an example and explain and there aren't any screenshots, looking for a tutorial like developing a web app something like facebook demo – user2528042 Sep 12 '13 at 17:22