简体   繁体   English

我尝试在 ubuntu 18.04 上将 django 与 postgreSQL 连接

[英]I try to connect django with postgreSQL on ubuntu 18.04

I am newbie on django , and I am facing the following issue.我是 django 的新手,我面临以下问题。 I have search for solution on the web but I couldn't find any yet.我在网上搜索了解决方案,但我还没有找到。

 File "/home/r00t/projects/mp/mp/lib/python3.6/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/home/r00t/projects/mp/mp/lib/python3.6/site-packages/psycopg2/__init__.py", line 127, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: invalid port number: "<5432>"

settings.py设置.py

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql'
        'NAME': '<mpdb>',
        'USER': '<admin>',
        'PASSWORD': '<r00t>',
        'HOST': '<127.0.0.1>',       
        'PORT': '<5432>',
    }
}

I have tried the following: port no: correct database name: correct user name: correct password: correct我尝试了以下操作:端口号:正确的数据库名称:正确的用户名:正确的密码:正确

Could you please help me out with thanks你能帮我吗 谢谢

When you see <foo> in descriptions or examples, it usually means you are supposed to replace those contents including the angle brackets with the real value.当您在描述或示例中看到<foo>时,通常意味着您应该用实际值替换包括尖括号在内的那些内容。 So after replacement the angle brackets are no longer there.所以更换后尖括号不再存在。 It looks like you have left the literal < and > in place, which is wrong.看起来您已经将文字<>留在原处,这是错误的。

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

相关问题 Azure VM Gunicorn上Ubuntu 18.04中的Django无法连接到(&#39;0.0.0.0&#39;,80) - Django in Ubuntu 18.04 on Azure VM gunicorn Can't connect to ('0.0.0.0', 80) 我尝试通过 python 上的一个脚本在 ubuntu 中连接网络 wifi - I try connect a network wifi in ubuntu through one script on python 无法将PostgreSQL与Django连接 - Not able to connect postgresql with django 在Ubuntu 18.04中使用MySQLdb或连接器将Python与MySQL连接 - Connect Python with MySQL using MySQLdb or connector in Ubuntu 18.04 当我尝试连接到我的 URL 时出现 Django NoReverseMatch 错误 - Django NoReverseMatch error when I try to connect to my URL 如何在 ubuntu 18.04 + plesk + apache 中在 digitalocean droplet 中部署 django 网站 - How to deploy django website in ubuntu 18.04 + plesk + apache in digitalocean droplet nginx 在 18.04 LTS 上运行 django 时 uwsgi 出现 502 错误 - nginx gives 502 error with uwsgi for running django on ubuntu 18.04 LTS 什么是在ubuntu中连接postgresql与android的方法 - what is the way to connect postgresql with android in ubuntu django 无法连接到 RDS postgresql - django cannot connect to RDS postgresql 无法使用 Django 上的 SSL 连接到 PostgreSQL - Unable to connect to PostgreSQL with SSL on Django
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM