[英]Django MSSQL server on docker container won't migrate
更新:已解決
我正在使用macOS,virtualenv上的Django 2.0和已安裝並運行SQL Server 2017的Docker容器。 我正在嘗試使用此軟件包: https : //github.com/michiya/django-pyodbc-azure
這是我的DATABASES settings.py設置:
DATABASES = {
'default': {
'ENGINE': 'sql_server.pyodbc',
'NAME': 'TUTORIAS_DATOS',
'HOST': '0.0.0.0',
'PORT': '1402',
'USER': '***',
'PASSWORD': '***',
'OPTIONS': {
'driver': 'ODBC Driver 13 for SQL Server',
'driver_charset': 'iso-8859-1',
}
}
}
問題是當我執行python manage.py makemigrations
進行遷移,但是當我嘗試將遷移應用於數據庫時( python manage.py migrate
),我得到:
Operations to perform:
Apply all migrations: admin, auth, contenttypes, menu, sessions
Running migrations:
No migrations to apply.
如果使用sqlite(默認的Django數據庫),則應該得到的不是:
Operations to perform:
Apply all migrations: admin, auth, contenttypes, menu, sessions
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 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 menu.0001_initial... OK
Applying sessions.0001_initial... OK
我不知道可能是什么問題,理論上,如果我按照以下步驟操作(在Windows上),它就可以正常工作。
ODBC連接顯然正在工作,因為如果我設置了不正確的用戶名/密碼,則會收到錯誤消息。 我的數據庫(托管在0.0.0.0:1402上的容器)的名稱確實是TUTORIAS_DATOS
更新:我正在使用TeamSQL應用程序“查看”數據庫中的表並進行查詢。 我幾乎不知道該應用程序無法正常運行。.我已連接到容器並通過sqlcmd
查詢,並且表在那里。
問題已解決,無論如何都要感謝您的評論。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.