django virtualenv - Error: No module named south
14,585
dont be a sudoer when installing south or running syncdb. just do
pip install south python manage.py syncdb
Author by
Andrius
Updated on June 05, 2022Comments
-
Andrius almost 2 years
I'm getting this error, when I try this:
source ./env/bin/activate
sudo python manage.py syncdb
Error: No module named south
I installed south after activating virtual env, using pip install south (as well as django).
installed apps in settings.py:
INSTALLED_APPS = ( 'south', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles',
What could be the problem?
Update: I get this error when trying to sync without sudo. Maybe it is related with 'south' problem:
(env)andrius@ubuntu:~/djcode/myproject$ python manage.py syncdb
Syncing... Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line utility.execute() File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv self.execute(*args, **options.__dict__) File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute output = self.handle(*args, **options) File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 371, in handle return self.handle_noargs(**options) File "/home/andrius/env/local/lib/python2.7/site-packages/south/management/commands/syncdb.py", line 90, in handle_noargs syncdb.Command().execute(**options) File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute output = self.handle(*args, **options) File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 371, in handle return self.handle_noargs(**options) File "/home/andrius/env/local/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 57, in handle_noargs cursor = connection.cursor() File "/home/andrius/env/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 306, in cursor cursor = self.make_debug_cursor(self._cursor()) File "/home/andrius/env/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 177, in _cursor self.connection = Database.connect(**conn_params) File "/home/andrius/env/local/lib/python2.7/site-packages/psycopg2-2.4.6-py2.7-linux-x86_64.egg/psycopg2/__init__.py", line 178, in connect return _connect(dsn, connection_factory=connection_factory, async=async) psycopg2.OperationalError: FATAL: Peer authentication failed for user "django"
I created database and user for database using these commands:
template1=# create database finance; CREATE DATABASE template1=# grant all privileges on database finance to django; ERROR: role "django" does not exist template1=# create user django with password 'mydb123'; CREATE ROLE template1=# grant all privileges on database finance to django; GRANT template1=# \q
My database settings in settings.py:
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'finance', # Or path to database file if using sqlite3. 'USER': 'django', # Not used with sqlite3. 'PASSWORD': 'mydb123', # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', # Set to empty string for default. Not used with sqlite3. }
}
-
Andrius over 11 yearsUsually I don't use sudo, but I thought it required sudo, because of authentication error. My bad:)
-
geoidesic about 6 yearsFor me,
south
is not in installed apps but I still get this error. Andpip uninstall south
reports:south is not installed