通过有关django和boostrap的教程进行网站设计。
在django本地服务器上一切正常,但是当我尝试部署它时,出现了问题。
当我尝试通过他们的网站打开我的应用时遇到此错误。
我做了pip3冻结并更新了requirements.txt。\
我得到的错误。
OperationalError at /
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
Request Method: GET
Request URL: https://chrisleeslacker-website.herokuapp.com/
Django Version: 3.0.8
Exception Type: OperationalError
Exception Value:
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
Exception Location: /app/.heroku/python/lib/python3.6/site-packages/psycopg2/__init__.py in connect, line 127
Python Executable: /app/.heroku/python/bin/python
Python Version: 3.6.11
Python Path:
['/app/.heroku/python/bin',
'/app',
'/app/.heroku/python/lib/python36.zip',
'/app/.heroku/python/lib/python3.6',
'/app/.heroku/python/lib/python3.6/lib-dynload',
'/app/.heroku/python/lib/python3.6/site-packages']
Server time: Fri, 31 Jul 2020 23:31:35 +0000
Requirements.txt
absl-py==0.9.0
appdirs==1.4.4
asgiref==3.2.10
astunparse==1.6.3
blis==0.4.1
cachetools==4.1.1
certifi==2020.6.20
chardet==3.0.4
cloudpickle==1.5.0
comtypes==1.1.7
distlib==0.3.1
Django==3.0.8
filelock==3.0.12
fpdf==1.7.2
future==0.18.2
gast==0.3.3
google-auth==1.20.0
google-auth-oauthlib==0.4.1
google-pasta==0.2.0
grpcio==1.30.0
gunicorn==20.0.4
gym==0.17.2
gym-super-mario-bros==7.3.2
h5py==2.10.0
idna==2.10
imageio==2.9.0
Markdown==3.2.2
nes-py==8.1.4
numpy==1.19.1
oauthlib==3.1.0
opencv-python==4.3.0.36
opt-einsum==3.3.0
pandas==1.1.0
Pillow==7.2.0
protobuf==3.12.4
psycopg2==2.8.5
psycopg2-binary==2.8.5
pyasn1==0.4.8
pyasn1-modules==0.2.8
pyglet==1.5.7
python-dateutil==2.8.1
pytz==2020.1
PyYAML==5.3.1
requests==2.24.0
requests-oauthlib==1.3.0
rsa==4.6
scipy==1.5.2
six==1.15.0
sqlparse==0.3.1
termcolor==1.1.0
urllib3==1.25.10
virtualenv==20.0.29
Werkzeug==1.0.1
wrapt==1.12.1
答案 0 :(得分:-1)
在Setting.py文件中,更改如下:
ALLOWED_HOSTS = ['.herokuapp.com']