Pythonanywhere:在.ipynb Python笔记本中运行Django shell

时间:2017-06-15 13:13:50

标签: python django shell jupyter-notebook pythonanywhere

我在Pythonanywhere上运行Django。我在具有manage.py文件的同一目录中创建了一个.ipynb笔记本。

我添加了以下代码:

import csv, os,sys
from __future__ import absolute_import
from django.conf import settings
settings.configure()
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settingsfile")
import django
django.setup()
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

from app.models import model_one, model_two

但是我收到以下错误:

RuntimeError: Model class app.models.the_model doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

有人可以告诉我如何纠正它,在iPython笔记本中运行python shell的最佳方法是什么? TIA

0 个答案:

没有答案