Djangoのinspectdbを使ってMySQLデータベースの情報からモデルを作りました。
そこで、MySQLのdumpデータをDjangoにインポートしたいのですが、うまくいきません。
https://docs.djangoproject.com/en/1.8/howto/initial-data/#providing-initial-sql-data
を見ながら、portfolioアプリディレクトリの中にsql/actressmaster.sqlを作り(モデル名はActressMasterです。)、python manage.py migrateをしたのですが、
(venv)hoge-MacBook-Air:avdatapage hoge$ python manage.py migrate Operations to perform: Synchronize unmigrated apps: staticfiles, messages Apply all migrations: admin, portfolio, contenttypes, auth, sessions Synchronizing apps without migrations: Creating tables... Running deferred SQL... Installing custom SQL... Running migrations: No migrations to apply.
と出るだけで、データがインポートされません。
SQLデータをDjangoにインポートする方法を教えていただけませんでしょうか。
ディレクトリ構造
. └── avdatapage ├── avdatapage │ ├── __init__.py │ ├── __init__.pyc │ ├── settings.py │ ├── settings.pyc │ ├── urls.py │ ├── urls.pyc │ ├── views.py │ ├── views.pyc │ ├── wsgi.py │ └── wsgi.pyc ├── db.sqlite3 ├── manage.py ├── portfolio │ ├── __init__.py │ ├── __init__.pyc │ ├── admin.py │ ├── admin.pyc │ ├── forms.py │ ├── forms.pyc │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0001_initial.pyc │ │ ├── 0002_auto_20150817_0851.py │ │ ├── 0002_auto_20150817_0851.pyc │ │ ├── __init__.py │ │ └── __init__.pyc │ ├── models.py │ ├── models.pyc │ ├── sql │ │ └── actressmaster.sql │ ├── templates │ │ ├── about.html │ │ ├── base.html │ │ ├── contact.html │ │ ├── index.html │ │ ├── login.html │ │ ├── logout.html │ │ └── portfolio │ │ ├── detail.html │ │ └── edit.html │ ├── tests.py │ ├── urls.py │ ├── urls.pyc │ ├── views.py │ └── views.pyc ├── static │ └── portfolio │ ├── bootstrap │ │ ├── css │ │ │ ├── 4-col-portfolio.css │ │ │ ├── bootstrap.css │ │ │ └── bootstrap.min.css │ │ ├── fonts │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.svg │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ └── glyphicons-halflings-regular.woff2 │ │ └── js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ └── jquery.js
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。