[英]Project created using cookiecutter-django not running
Its been a few months that I am trying to learn Django. 我尝试学习Django已经几个月了。 In the same process (and while reading "Two Scoops of Django 1.11"), I came across Cookiecutter Django. 在相同的过程中(并且在阅读“ Django 1.11的两个瓢”时),我遇到了Cookiecutter Django。 It has helped me learn a few important things to keep in mind while creating a project. 它帮助我学习了创建项目时要记住的一些重要事项。
I tried to run the template provided by cookiecutter-django but failed. 我试图运行cookiecutter-django提供的模板,但失败了。 Here are the steps that I followed. 这是我遵循的步骤。
mkvirtualenv test
pip install coockiecutter
cookiecutter https://github.com/pydanny/cookiecutter-django
python manage.py migrate
运行python manage.py migrate
The result was the error: 结果是错误:
django.db.utils.OperationalError: FATAL: role "dev" does not exist
I have also tried making a user named test_project_user and granting it all the privileges to test_project database. 我还尝试过创建一个名为test_project_user的用户,并将其所有特权授予test_project数据库。 I am still getting the same error. 我仍然遇到相同的错误。
The problem seems to be that you specified a database user that does not exist (or you left blank and it assumes your system user), in: 问题似乎是您在以下位置中指定了一个不存在的数据库用户(或者您留空并假定您是系统用户):
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'test_project',
'USER': 'HERE', # Set test_project_user here
...
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.