简体   繁体   English

Heroku教程错误运行python manage.py syncdb更新本地数据库

[英]Heroku tutorial error running python manage.py syncdb to update local database

This question has been asked before and answered here , and I understand the reasoning as to why I am getting the error, however I am still unclear about the solution from the answer given. 这个问题已经被问过并在这里回答 ,我理解为什么我得到错误的原因,但是我仍然不清楚给出答案的解决方案。 What code or changes should I be adding to make it work? 我应该添加什么代码或更改以使其起作用? Do I need to make changes to 我是否需要对

 DATABASES['default'] =  dj_database_url.config()

in my settings? 在我的设置中? The tutorial isn't very clear about this. 本教程对此并不十分清楚。 Thanks for any help. 谢谢你的帮助。

设置并使用带有DATABASE_URL config var的virtualenv ,或使用DATABASE_URL=postgres:///databasename <how you'd normally run your program>

What ended up working eventually was to add: 最终起作用的是添加:

import dj_database_url
DATABASES['default'] =  dj_database_url.config(default='postgres://<user>:<password>@localhost:5432/<name>')

instead of just 而不只是

import dj_database_url
DATABASES['default'] =  dj_database_url.config()

like the tutorial states. 就像本教程的状态一样。 Then when trying to run 然后在尝试运行时

python manage.py runserver

I still got the error 我仍然有错误

ImportError: DLL load failed: %1 is not a valid Win32 application.

I then was able to figure out that the stickpeople build i needed to use was the 64 bit instead of the 32 bit that the tutorial had me use, and the 64 bit build is: 然后,我能够确定我需要使用的stickpeople版本是64位而不是本教程使用的32位版本,而64位版本是:

easy_install http://www.stickpeople.com/projects/python/win-psycopg/psycopg2-2.4.5.win-amd64-py2.7-pg9.1.3-release.exe

I don't know if it was the best way, but in order to use the 64 bit build I started over from the beginning. 我不知道这是否是最好的方法,但是为了使用64位版本,我从头开始。 Now it finally works. 现在终于可以了。 Hopefully this can also be used to help anyone else who is also stuck. 希望这也可以用于帮助其他也陷入困境的人。 There are a lot of holes in the heroku tutorial. heroku教程中有很多漏洞。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM