How to connect Django database to Sql server? [duplicate] - python

This Django project is working before I created another Django project on my computer. But today when I run the project it shows error message like that=>
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "Users..\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "Users..\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\__init__.py", line 377, in execute
django.setup()
File "Users..\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "Users..\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\apps\registry.py", line 114,
in populate
app_config.import_models()
File "Users..\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\apps\config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "Users..\AppData\Local\Programs\Python\Python37-32\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "Users..\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\contrib\auth\models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "Users..\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\contrib\auth\base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "Users..\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\models\base.py", line 121, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "Users..\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\models\base.py", line 325, in add_to_class
value.contribute_to_class(cls, name)
File "Users..\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\models\options.py", line 208, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "Users..\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\__init__.py", line 28, in
__getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "Users..\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\utils.py", line 207, in __getitem__
backend = load_backend(db['ENGINE'])
File "Users..\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\utils.py", line 111, in load_backend
return import_module('%s.base' % backend_name)
File "Users..\AppData\Local\Programs\Python\Python37-32\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "Users..\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sql_server\pyodbc\base.py", line 12, in <module>
raise ImproperlyConfigured("Django %d.%d.%d is not supported." % VERSION[:3])
django.core.exceptions.ImproperlyConfigured: Django 3.0.1 is not supported.
What is mean Django 3.0.1 is not supported?

The sql_server package you're using isn't compatible with Django 3.0 or higher. It's not clear from your question which sql_server package you're using (is it django-pyodbc?) but most of the packages haven't added support for Django 3.0 yet.
Use a version of Django that is compatible with you django-pyodbc package (consult the documentation of the package, probably you should be using Django 2.1 or 2.2) or fork the package and modify it to support Django 3.0.

your problem is due to installing different version for your new project.you should use a different virtual environment for each project to avoiding this problems.

Can you please create virtualenv using python3.7.3 then install Django3 inside virtualenv. Because Django3 support only Pyth on3.6 and upper. Maybe some python version compatibility issue is there. for python version change please follow this link .. https://unix.stackexchange.com/questions/410579/change-the-python3-default-version-in-ubuntu

Related

Unable to setup mysql with Django on Mac

I installed the recent version of MySQL for my mac (macOS 12(ARM, 64-bit), DMG Archive) and created a database called storefront. I'm working in a pipenv virtual environment and install mysqlclient. I've also updated my DATABASES settings to point to my new database in my settings.py file.
DB Settings. But whenever I try to run the server I get an error. NameError: name '_mysql' is not defined Also at the top, (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e') I thought by installing the ARM version I wouldn't deal with this error. I wonder if it's pointing to the wrong file within my env despite adding the PATH to my .zshrc info. Is there a special way to point to the correct mysql or am I setting things up incorrectly? Here's my error message "
Traceback (most recent call last):
File "/Users/a0c08w6/.local/share/virtualenvs/storefront-A2x2yZd3/lib/python3.9/site-packages/MySQLdb/__init__.py", line 18, in <module>
from . import _mysql
ImportError: dlopen(/Users/a0c08w6/.local/share/virtualenvs/storefront-A2x2yZd3/lib/python3.9/site-packages/MySQLdb/_mysql.cpython-39-darwin.so, 0x0002): tried: '/Users/a0c08w6/.local/share/virtualenvs/storefront-A2x2yZd3/lib/python3.9/site-packages/MySQLdb/_mysql.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/a0c08w6/Documents/Scripts/Django/storefront/manage.py", line 22, in <module>
main()
File "/Users/a0c08w6/Documents/Scripts/Django/storefront/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/Users/a0c08w6/.local/share/virtualenvs/storefront-A2x2yZd3/lib/python3.9/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
utility.execute()
File "/Users/a0c08w6/.local/share/virtualenvs/storefront-A2x2yZd3/lib/python3.9/site-packages/django/core/management/__init__.py", line 420, in execute
django.setup()
File "/Users/a0c08w6/.local/share/virtualenvs/storefront-A2x2yZd3/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/a0c08w6/.local/share/virtualenvs/storefront-A2x2yZd3/lib/python3.9/site-packages/django/apps/registry.py", line 116, in populate
app_config.import_models()
File "/Users/a0c08w6/.local/share/virtualenvs/storefront-A2x2yZd3/lib/python3.9/site-packages/django/apps/config.py", line 304, in import_models
self.models_module = import_module(models_module_name)
File "/opt/homebrew/Cellar/python#3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/Users/a0c08w6/.local/share/virtualenvs/storefront-A2x2yZd3/lib/python3.9/site-packages/django/contrib/auth/models.py", line 3, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/Users/a0c08w6/.local/share/virtualenvs/storefront-A2x2yZd3/lib/python3.9/site-packages/django/contrib/auth/base_user.py", line 49, in <module>
class AbstractBaseUser(models.Model):
File "/Users/a0c08w6/.local/share/virtualenvs/storefront-A2x2yZd3/lib/python3.9/site-packages/django/db/models/base.py", line 141, in __new__
new_class.add_to_class("_meta", Options(meta, app_label))
File "/Users/a0c08w6/.local/share/virtualenvs/storefront-A2x2yZd3/lib/python3.9/site-packages/django/db/models/base.py", line 369, in add_to_class
value.contribute_to_class(cls, name)
File "/Users/a0c08w6/.local/share/virtualenvs/storefront-A2x2yZd3/lib/python3.9/site-packages/django/db/models/options.py", line 235, in contribute_to_class
self.db_table, connection.ops.max_name_length()
File "/Users/a0c08w6/.local/share/virtualenvs/storefront-A2x2yZd3/lib/python3.9/site-packages/django/utils/connection.py", line 15, in __getattr__
return getattr(self._connections[self._alias], item)
File "/Users/a0c08w6/.local/share/virtualenvs/storefront-A2x2yZd3/lib/python3.9/site-packages/django/utils/connection.py", line 62, in __getitem__
conn = self.create_connection(alias)
File "/Users/a0c08w6/.local/share/virtualenvs/storefront-A2x2yZd3/lib/python3.9/site-packages/django/db/utils.py", line 208, in create_connection
backend = load_backend(db["ENGINE"])
File "/Users/a0c08w6/.local/share/virtualenvs/storefront-A2x2yZd3/lib/python3.9/site-packages/django/db/utils.py", line 113, in load_backend
return import_module("%s.base" % backend_name)
File "/opt/homebrew/Cellar/python#3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Users/a0c08w6/.local/share/virtualenvs/storefront-A2x2yZd3/lib/python3.9/site-packages/django/db/backends/mysql/base.py", line 15, in <module>
import MySQLdb as Database
File "/Users/a0c08w6/.local/share/virtualenvs/storefront-A2x2yZd3/lib/python3.9/site-packages/MySQLdb/__init__.py", line 24, in <module>
version_info, _mysql.version_info, _mysql.__file__
NameError: name '_mysql' is not defined
Error tell you, you have mysql macOs build for x86_64, but you should set up build for 'arm64e'.
here you can find both version for macOs:
https://dev.mysql.com/downloads/mysql/
I install mySql many times on macos... and now i have mariaDb
https://mariadb.com/kb/en/installing-mariadb-on-macos-using-homebrew/
For me it was easier to install

Django runserver error, new installation, first time user of Django

So I've decided to learn Django, which will be challenging if I cannot get it working.
Running
Python 3.7.1 (default, Dec 14 2018, 19:28:38)
[GCC 7.3.0] :: Anaconda, Inc. on linux
(base) runout#runout:~$ python -m django --version
2.2.1
I'm following the tutorial for beginners at djangoproject.com
The first line of code was to create a site, which i did...
django-admin startproject mysite
The second line of code, is where I run into problems.
python manage.py runserver
My error is as follows:
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/home/runout/anaconda3/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/home/runout/anaconda3/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/utils/autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/utils/autoreload.py", line 77, in raise_last_exception
raise _exception[0](_exception[1]).with_traceback(_exception[2])
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/utils/autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/apps/config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "/home/runout/anaconda3/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/contrib/auth/models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/db/models/base.py", line 117, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/db/models/base.py", line 321, in add_to_class
value.contribute_to_class(cls, name)
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/db/models/options.py", line 204, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/db/__init__.py", line 28, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/db/utils.py", line 201, in __getitem__
backend = load_backend(db['ENGINE'])
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/db/utils.py", line 110, in load_backend
return import_module('%s.base' % backend_name)
File "/home/runout/anaconda3/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 28, in <module>
from .introspection import DatabaseIntrospection # isort:skip
File "/home/runout/anaconda3/lib/python3.7/site-packages/django/db/backends/sqlite3/introspection.py", line 4, in <module>
import sqlparse
ModuleNotFoundError: No module named 'sqlparse'
I know nothing of Django, I'm excited to learn. I've looked all over the net and SO for a solution to this problem to no avail. Can anyone get me up and running?
Apparently a python package is missing. You can install it like this:
pip install sqlparse
You're on Linux so install 'sqlparse' by typing:
pip3 install sqlparse. Also you should call python with python3, so that it's not confused with python2.

from tagging/models.py: ImportError: cannot import name 'generic'

While running server import error is generated. Here I even don't use this generic types anywhere in my file.
Then how can this error is generated???
C:\Python34\python.exe manage.py runserver
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x0000000004BC8B70>
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\django-2.0-py3.4.egg\django\utils\autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "C:\Python34\lib\site-packages\django-2.0-py3.4.egg\django\core\management\commands\runserver.py", line 112, in inner_run
autoreload.raise_last_exception()
File "C:\Python34\lib\site-packages\django-2.0-py3.4.egg\django\utils\autoreload.py", line 248, in raise_last_exception
raise _exception[1]
File "C:\Python34\lib\site-packages\django-2.0-py3.4.egg\django\core\management\__init__.py", line 327, in execute
autoreload.check_errors(django.setup)()
File "C:\Python34\lib\site-packages\django-2.0-py3.4.egg\django\utils\autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "C:\Python34\lib\site-packages\django-2.0-py3.4.egg\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Python34\lib\site-packages\django-2.0-py3.4.egg\django\apps\registry.py", line 112, in populate
app_config.import_models()
File "C:\Python34\lib\site-packages\django-2.0-py3.4.egg\django\apps\config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "C:\Python34\lib\importlib\__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "C:\Python34\lib\site-packages\tagging\models.py", line 5, in <module>
from django.contrib.contenttypes import generic
ImportError: cannot import name 'generic'
Your tagging library does not support Django 2.0. If you check Django's git repo, you will see that there is no more generic module in Django.contrib.contenttypes. It was removed in Django 1.9. Downgrade to Django 1.8 for your library to work or, which I would recommend, use a different tagging library, preferably one that is well enough maintained to support at least Django 1.11.
I had solved the error.
In settings.py file, there is INSTALLED_APPS. I removed 'tagging'
from that which solves all my errors.
Hope this helps.

Django app failed to connect with ms sql server 2014

I am new in django,stuck on migration process, as a beginner can not find valuable information from error message. Need help about migration and db connection with application process.
pip list
Django (1.11.2)
django-mssql (1.8)
mysqlclient (1.3.10)
pip (9.0.1)
pytz (2017.2)
setuptools (28.8.0)
wheel (0.29.0)
Python 3.6.1
To install Python package manage for ms sql server used bellow command
pip install django-mssql
My app model is
from django.db import models
# Create your models here.
class Video(models.Model):
title=models.CharField("Title",max_length=250)
embed_code=models.TextField("Embed code")
My django application database settings is bellow
DATABASES = {
'default': {
'NAME': 'djangolife',# db name
'ENGINE': 'sqlserver_ado',
'HOST': 'DESKTOP-SVHDHF8\\MSSQLSERVER2014',#Sql server name
'USER': 'sa',
'PASSWORD': 'sa123',
}
}
Migration command
python manage.py makemigrations
After execute the above migration command get bellow errors
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\shamim\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 363, in execute_from_command_line
utility.execute()
File "C:\Users\shamim\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 337, in execute
django.setup()
File "C:\Users\shamim\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\shamim\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\registry.py", line 108, in populate
app_config.import_models()
File "C:\Users\shamim\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\apps\config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\shamim\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "C:\Users\shamim\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\contrib\auth\models.py", line 4, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "C:\Users\shamim\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\contrib\auth\base_user.py", line 52, in <module>
class AbstractBaseUser(models.Model):
File "C:\Users\shamim\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\base.py", line 124, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "C:\Users\shamim\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\base.py", line 330, in add_to_class
value.contribute_to_class(cls, name)
File "C:\Users\shamim\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\models\options.py", line 214, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "C:\Users\shamim\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\__init__.py", line 33, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "C:\Users\shamim\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\utils.py", line 212, in __getitem__
conn = backend.DatabaseWrapper(db, alias)
File "C:\Users\shamim\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlserver_ado\base.py", line 184, in __init__
super(DatabaseWrapper, self).__init__(*args, **kwargs)
File "C:\Users\shamim\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\base\base.py", line 96, in __init__
self.client = self.client_class(self)
TypeError: 'NoneType' object is not callable
I have the same issue and I found the reason is django-mssql support Django 1.8 but you are using Django 1.11. Please downgrade your Django version or wait until the latest version will be supported.

Trouble with psycopg2 setting up django

I'm trying to set up a Django app using a postgresql server (to eventually use with GeoDjango for GIS). I'm on a mac running OSX 10.11 and am running python 3.5 in a virtualenv. I've gone through all the installtion of postgresql, pyscopg2 etc and am trying to run
python manage.py migrate
But when I do I get the following error.
Traceback (most recent call last):
File "/Users/me/.python3env/lib/python3.5/site-packages/django/db/backends/postgresql/base.py", line 20, in <module>
import psycopg2 as Database
File "/Users/me/.python3env/lib/python3.5/site-packages/psycopg2/__init__.py", line 50, in <module>
from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: dlopen(/Users/me/.python3env/lib/python3.5/site-packages/psycopg2/_psycopg.cpython-35m-darwin.so, 2): Library not loaded: libssl.1.0.0.dylib
Referenced from: /Users/me/.python3env/lib/python3.5/site-packages/psycopg2/_psycopg.cpython-35m-darwin.so
Reason: image not found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/Users/me/.python3env/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/Users/me/.python3env/lib/python3.5/site-packages/django/core/management/__init__.py", line 341, in execute
django.setup()
File "/Users/me/.python3env/lib/python3.5/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/me/.python3env/lib/python3.5/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/Users/me/.python3env/lib/python3.5/site-packages/django/apps/config.py", line 199, in import_models
self.models_module = import_module(models_module_name)
File "/Users/me/.python3env/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/Users/me/.python3env/lib/python3.5/site-packages/django/contrib/auth/models.py", line 4, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/Users/me/.python3env/lib/python3.5/site-packages/django/contrib/auth/base_user.py", line 52, in <module>
class AbstractBaseUser(models.Model):
File "/Users/me/.python3env/lib/python3.5/site-packages/django/db/models/base.py", line 119, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "/Users/me/.python3env/lib/python3.5/site-packages/django/db/models/base.py", line 316, in add_to_class
value.contribute_to_class(cls, name)
File "/Users/me/.python3env/lib/python3.5/site-packages/django/db/models/options.py", line 214, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/Users/me/.python3env/lib/python3.5/site-packages/django/db/__init__.py", line 33, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/Users/me/.python3env/lib/python3.5/site-packages/django/db/utils.py", line 211, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Users/me/.python3env/lib/python3.5/site-packages/django/db/utils.py", line 115, in load_backend
return import_module('%s.base' % backend_name)
File "/Users/me/.python3env/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Users/me/.python3env/lib/python3.5/site-packages/django/db/backends/postgresql/base.py", line 24, in <module>
raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: dlopen(/Users/me/.python3env/lib/python3.5/site-packages/psycopg2/_psycopg.cpython-35m-darwin.so, 2): Library not loaded: libssl.1.0.0.dylib
Referenced from: /Users/me/.python3env/lib/python3.5/site-packages/psycopg2/_psycopg.cpython-35m-darwin.so
Reason: image not found
I've found a couple of stackoverflow threads on this error but none of the solutions seem to help at all.
Any advice would be much appreciated!
Edit: brew doctor output
Warning: python is symlinked to python3
This will confuse build scripts and in general lead to subtle breakage.
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
/Users/me/.python3env/bin/python-config
Warning: Python is installed at /Library/Frameworks/Python.framework
Homebrew only supports building against the System-provided Python or a
brewed Python. In particular, Pythons installed to /Library can interfere
with other software installs.

Categories

Resources