Django

get_template()でUnicodeDecodeError

ファイルの文字コードをutf-8にしてで保存する http://stackoverflow.com/questions/11072478/python-unicodedecodeerror-utf8-codec-cant-decode-byte-unexpected-code-byt http://advweb.seesaa.net/article/3074705.html

重複をカラム指定して削除してオブジェクト取得

http://stackoverflow.com/questions/3852104/select-distinct-individual-columns-in-django

AppRegistryNotReady: Models aren't loaded yet.

objects.all().delete()でエラー C:\Users\shohaya\tf-manager\tfmanager\db>python initteam.py Traceback (most recent call last): File "initteam.py", line 60, in init_team() File "initteam.py", line 49, in init_team obj.delete() File "C:\Anaco…

settings読み込みエラー

django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. 環境変数…

django1.7新機能migrations

http://a-records.info/2014/09/29/18/

django.db.utils.Error: ('00000', '[00000] [iODBC][Driver Manager]dlopen({SQL Server Native Client 10.0}, 6): image not found (0) (SQLDriverConnect)')

~/TFManager/tfmanager $ python manage.py migrate --list Traceback (most recent call last): File "manage.py", line 10, in execute_from_command_line(sys.argv) File "/Users/shohayakawa/anaconda/lib/python2.7/site-packages/django/core/manageme…

macにSQL Server Expressはインストールできない?

macではできないっぽい http://dba.stackexchange.com/questions/62513/sql-server-on-mac linuxではできる? http://msdn.microsoft.com/en-us/library/hh568451%28v=sql.110%29.aspx

Error creating new content types. Please make sure contenttypes is migrated before trying to migrate apps individually

Error creating new content types. Please make sure contenttypes is migrated before trying to migrate apps individually djangoでmigrationのラベルを指定してmigrateしようとした時のエラー。このときはDB移行した時の最初のmigrateだったのでcontent…

Windows Azure SQL Database 管理ポータルから接続文字列をコピーしてきて使う場合

Windows Azure SQL Database 管理ポータルから接続文字列をコピーしてきて使う場合は、SQL Server Native Client 11 の場合、ODBC 接続において Driver 指定を、{SQL Server Native Client 10.0} → {SQL Server Native Client 11.0} に書き換える必要あり ht…

ERROR IM002 Microsoft ODBC Driver Manager

ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified in SSRS odbcのエラー settings.pyで指定しているODBCの名前が違うことによるエラーだった。 あとSQL Server Expressをインストールしていない…

UnicodeDecodeError: 'utf8' codec can't decode byte 0x97 in position 3

pipでインストール時にUnicodeDecodeError C:\> pip install django-pyodbc-azure Downloading/unpacking django-pyodbc-azure Cleaning up... Exception: Traceback (most recent call last): File "C:\Anaconda\lib\site-packages\pip\basecommand.py", li…

django-pyodbc-azureをインストール

$ sudo pip install django-pyodbc-azure Password: Requirement already satisfied (use --upgrade to upgrade): django-pyodbc-azure in /Users/shohayakawa/anaconda/lib/python2.7/site-packages Downloading/unpacking Django>=1.7.1 (from django-pyod…

pipでpyodbcインストール時にエラー

n file included from /private/tmp/pip_build_root/pyodbc/src/buffer.cpp:12: /private/tmp/pip_build_root/pyodbc/src/pyodbc.h:52:10: fatal error: 'sql.h' file not found #include sql.h ^ 1 error generated. error: command 'gcc' failed with exit…

Djangoで既存テーブルの構造変更

調べてみるとmodelを変更した後にalter tableしないといけないとあったが、しなくてもできたっぽい。 ①model変更②makemigrations③migrate python manage.py makemigrations python manage.py migrate http://i2bskn.hateblo.jp/entry/20120616/1339852257 ht…

DjangoでDBにテーブル追加

①Modelにクラス追加 ②makemigrations python manage.py makemigrations ③migrate python manage.py migrate

python manage.py migrateでエラー

$ python manage.py migrate --list 上記のコマンドでmigrationの状態を確認 admin [X] 0001_initial auth [X] 0001_initial contenttypes [X] 0001_initial login [X] 0001_initial manager [X] 0001_initial [X] 0002_auto_20140922_1937 [ ] 0003_auto_20…

DBのテーブルにカラム追加

http://ameblo.jp/ekispresso/entry-11485508958.html

attributeerror user has been swapped

AttributeError: Manager isn't available; User has been swapped for 'login.User' http://stackoverflow.com/questions/17873855/manager-isnt-available-user-has-been-swapped-for-pet-person