草庐IT

migrations

全部标签

python - flask-migrate 不检测模型

我正在阅读(和观看)有关Flask-Migrate的信息:https://realpython.com/blog/python/flask-by-example-part-2-postgres-sqlalchemy-and-alembic/在这里https://www.youtube.com/watch?v=YJibNSI-iaE#t=21并完成本教程中的所有操作:我启动了一个本地postgres服务器(使用Postgres.App,它在postgresql://localhost:5432启动了服务器)根据所述教程更新配置更新了app.py,创建了models.py等。安装Flask

python - 属性错误 : 'Graph' object has no attribute 'cypher' in migration of data from Postgress to Neo4j(Graph Database)

我正在手动将数据从postgres迁移到图形数据库。我写了下面的脚本:importpsycopg2frompy2neoimportauthenticate,Graphauthenticate("localhost:7474","neo4j","password")n4j_graph=Graph("http://localhost:7474/db/data/")try:conn=psycopg2.connect("dbname='db_name'user='user'password='password'")except:print"goodbye"cur=conn.cursor()tr

python - 南 : Unknown command 'migrate'

我变得无情了$pythonmanage.pymigrateUnknowncommand:'migrate'Type'manage.pyhelp'forusage.我将代码从github拉到一台新电脑上。此代码已经过测试,可以在其他计算机上运行。除了我无法运行迁移之外,整个代码运行良好!安装我的虚拟环境并运行pipinstall-rrequirements.txt。它安装一切,包括南方。我可以通过运行来检查$pythonmanage.pyshell>>>importsouth>>>south.__version__'0.7.3'但是,当我运行manage.pyhelp时,migrate和

python - Django:python manage.py migrate 什么都不做

我刚开始学习Django,当我尝试应用我的迁移时,第一个问题出现了。我启动服务器,输入pythonmanage.pymigrate什么也没有发生。没有错误,没有崩溃,只是没有响应。Performingsystemchecks...Systemcheckidentifiednoissues(0silenced).Youhave13unappliedmigration(s).Yourprojectmaynotworkproperlyuntilyouapplythemigrationsforapp(s):admin,auth,contenttypes,sessions.Run'pythonm

python - 无法使用 Flask-Migrate (Alembic) 迁移或升级数据库

我一直在使用Flask-Migrate(Alembic)来更新我的数据库。我更新了我的models.py文件,但我犯了一个错误。我运行了一个迁移并去升级数据库,但是我得到了这个错误:sqlalchemy.exc.IntegrityError:(_mysql_exceptions.IntegrityError)(1215,'Cannotaddforeignkeyconstraint')[SQL:u'\nCREATETABLEtopics(\n\tidINTEGERNOTNULLAUTO_INCREMENT,\n\t`subjectID`INTEGER,\n\ttopicVARCHAR(1

python - Django Heroku 错误 "Your models have changes that are not yet reflected in a migration"

我最近向我的应用程序(UserProfile)添加了一个模型,当我将更改推送到Heroku时,我想我不小心运行了herokurunpythonmanage.pymakemigrations。现在,当我尝试运行herokurunpythonmanage.pymigrate时,出现以下错误(leaguemaster)benjamins-mbp-2:leaguemasterBen$herokurunpythonmanage.pymigrateRunning`pythonmanage.pymigrate`attachedtoterminal...up,run.1357Operationstop

python - PyTest-Django 因缺少 django_migration 表而失败

我正在尝试将pytest-django添加到我当前的pytest3/Django1.7环境中。目前我们还没有使用该插件,并且一直受到某些测试之间的共享状态的困扰在我收到以下错误消息时,一切似乎都在视觉上看起来不错,并且测试似乎一直通过,直到结束:request=>@pytest.fixture(autouse=True)def_django_db_marker(request):"""Implementthedjango_dbmarker,internaltopytest-django.Thiswilldynamicallyrequestthe``db``or``transaction

python - 值错误 : Dependency on app with no migrations: customuser

我正在尝试使用Django框架启动网页。这是我的第一个Web开发项目。创建项目后,我尝试启动一个应用程序,该应用程序利用自定义用户并使用django-registration通过电子邮件验证进行注册。这是我运行managerunserver时发生的情况:这是models.py文件包含的内容:fromdjango.dbimportmodelsfromdjango.contrib.auth.modelsimportAbstractUserfromdjango.utils.translationimportugettext_lazyas_classUser(AbstractUser):use

python - 从 django.db 导入模型,迁移 ImportError : cannot import name migrations

所以我开始在我的Django网络服务器上遇到一些关于south的问题。迁移命令每次都失败并显示此输出:fromdjango.dbimportmodels,migrationsImportError:cannotimportnamemigrations(上面的错误显示了迁移失败文件的路径)我的django版本是1.5.1,而我的south版本是0.8.4最让我烦恼的是找不到模块django.db.migrations。有什么想法吗? 最佳答案 迁移是在Django1.7中引入的;您使用的是1.5。这是一个linktothedocsex

python - Django 命令错误 : App 'polls' has migrations

尝试按照Djangoproject上的教程进行操作.我遇到的问题是执行命令时:pythonmanage.pysqlpolls我得到了错误:CommandError:App'polls'hasmigrations.onlythesqlmigrateandsqlflushcommandscanbeusedwhenanapphasmigrations到目前为止,我似乎无法在Internet或此网站上找到任何有关程序解决方案的指南。 最佳答案 您可以运行pythonmanage.pymakemigration然后运行​​pythonmana