참고 사이트 : https://blog.naver.com/domodal/221278673562
1. django-pyodbc-azure 설치 (기존설치된 Django 3.0.2를 uninstall하고 Django 2.1.15로 설치된다.)
(BlogVenv) C:\Work\Software\eclipse-jee-2019-12-R-win32-x86_64\workspace\Blog_sqlite>pip install django-pyodbc-azure
Collecting django-pyodbc-azure
Downloading https://files.pythonhosted.org/packages/18/ab/133c68bbea94839d8f3b8b4aea4f70e1c6b8ac929aba4adbadc458566a76/django_pyodbc_azure-2.1.0.0-py3-none-any.whl
Collecting Django<2.2,>=2.1.0
Downloading https://files.pythonhosted.org/packages/ff/82/55a696532518aa47666b45480b579a221638ab29d60d33ce71fcbd3cef9a/Django-2.1.15-py3-none-any.whl (7.3MB)
|| 7.3MB 327kB/s
Collecting pyodbc>=3.0
Downloading https://files.pythonhosted.org/packages/59/2b/0e7998a84f1a54726570d28039c40bd2668abb6cc70a7316ef668aeb1aff/pyodbc-4.0.28-cp37-cp37m-win32.whl (59kB)
|| 61kB 4.1MB/s
Requirement already satisfied: pytz in c:\work\software\eclipse-jee-2019-12-r-win32-x86_64\workspace\blog_sqlite\blogvenv\lib\site-packages (from Django<2.2,>=2.1.0->django-pyodbc-azure) (2019.3)
Installing collected packages: Django, pyodbc, django-pyodbc-azure
Found existing installation: Django 3.0.2
Uninstalling Django-3.0.2:
Successfully uninstalled Django-3.0.2
Successfully installed Django-2.1.15 django-pyodbc-azure-2.1.0.0 pyodbc-4.0.28
(BlogVenv) C:\Work\Software\eclipse-jee-2019-12-R-win32-x86_64\workspace\Blog_sqlite>pip list
Package Version
------------------- -------
asgiref 3.2.3
Django 2.1.15
django-disqus 0.5
django-pyodbc-azure 2.1.0.0
django-tagging 0.4.6
mock 3.0.5
Pillow 7.0.0
pip 19.3.1
pyodbc 4.0.28
pytz 2019.3
setuptools 44.0.0
six 1.13.0
sqlparse 0.3.0
wheel 0.33.6
2. setting.py 설정
------------------------------------------------------------------------------
DATABASES = {
'default': {
'ENGINE': 'sql_server.pyodbc',
'NAME': 'DB Name',
'HOST': 'IP ADDRESS',
'PORT': 'Port Number',
'USER': '계정',
'PASSWORD': '비번',
'OPTIONS': {
'driver': 'SQL Server Native Client 11.0',
'MARS_Connection': True,
'driver_supports_utf8': True,
}
}
}
-- 아래 옵션도 된다. (SQLSERVER 2014 Standard)
------------------------------------------------------------------------------
'OPTIONS': {
'driver': 'ODBC Driver 17 for SQL Server',
'unicode_results': True,
'host_is_server': True,
}
3. Table 생성
(BlogVenv) C:\Work\Software\eclipse-jee-2019-12-R-win32-x86_64\workspace\Blog_sqlite>python manage.py makemigrations
(BlogVenv) C:\Work\Software\eclipse-jee-2019-12-R-win32-x86_64\workspace\Blog_sqlite>python manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, post, sessions, sites, tagging
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying admin.0003_logentry_add_action_flag_choices... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying post.0001_initial... OK
Applying sessions.0001_initial... OK
Applying sites.0001_initial... OK
Applying sites.0002_alter_domain_unique... OK
Applying tagging.0001_initial... OK
Applying tagging.0002_on_delete... OK
Applying tagging.0003_adapt_max_tag_length... OK