简体   繁体   English

AWS-DJANGO-格式错误:OperationalError:fe_sendauth:未提供密码

[英]AWS - DJANGO - Error in formatting: OperationalError: fe_sendauth: no password supplied

I have just setup a Django app on aws beanstalk with PostgreSQL 9.4.7. 我刚刚使用PostgreSQL 9.4.7在AWS beantalk上设置了Django应用。 My database settings are as follows; 我的数据库设置如下;

if 'RDS_DB_NAME' in os.environ:
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.postgresql_psycopg2',
            'NAME': os.environ['RDS_DB_NAME'],
            'USER': os.environ['RDS_USERNAME'],
            'PASSWORD': os.environ['RDS_PASSWORD'],
            'HOST': os.environ['RDS_HOSTNAME'],
            'PORT': os.environ['RDS_PORT'],
        }
    }

I have installed psycopg2. 我已经安装了psycopg2。

AWS application installation completed successfully however when i opened by index page I received the following error. AWS应用程序安装成功完成,但是按索引页面打开时,出现以下错误。

Exception Type: RuntimeError
Exception Value:    
Error creating new content types. Please make sure contenttypes is migrated before trying to migrate apps individually.

Further digging into the exception page I found this error 进一步挖掘异常页面,我发现了此错误

**Variable**    
my_list 

**Value**
Error in formatting: OperationalError: fe_sendauth: no password supplied

**request** 
<WSGIRequest: GET '/new/'>

my_list is the variable defined in the index page view. my_list是在索引页面视图中定义的变量。

Further down the page I can see the DB values are updated correctly. 在页面的更下方,我可以看到数据库值已正确更新。

to check if there was some issue with the password I tried accessing aws RDS via pgadmin and was able to do so successfully so no issues there. 检查密码是否存在问题,我尝试通过pgadmin访问aws RDS,并且能够成功完成此操作,所以那里没有问题。

I have tried a lot of things but was not able to find a solution so need some assistance please. 我已经尝试了很多方法,但是找不到解决方案,因此需要一些帮助。

EDIT: I have also checked the tables after connecting with pgadmin and can confirm that all the tables have been created through migrate command (created in aws .config file) on the aws database. 编辑:与pgadmin连接后,我还检查了表,并可以确认所有表都是通过aws数据库上的migration命令(在aws .config文件中创建)创建的。 Just thought of sharing this in case this is helpful. 只是想分享一下以防万一。

EDIT 2: so on the error page if I go down to the settings section I can see both id and password reflecting (pass in ******** form). 编辑2:在错误页面上,如果我进入设置部分,则可以看到ID和密码(以********形式传递)。 However in the Traceback section I can see that password is None but rest of the info is there and this error is; 但是,在“回溯”部分中,我可以看到密码为“无”,但其余信息在那里,并且此错误是:

/opt/python/run/venv/lib64/python2.7/site-packages/psycopg2/__init__.py in connect
    conn = _connect(dsn, connection_factory=connection_factory, async=async) 

EDIT3: so I get everything from the db except for the password and I checked my env file found in /opt/python/current on aws ssh instance and found it had all the export settings correctly listed including the password. EDIT3:所以我从数据库中获得了除密码以外的所有内容,并检查了在aws ssh实例上的/ opt / python / current中找到的env文件,发现它正确列出了所有导出设置,包括密码。

To be more explicit, below I have mentioned the exception detail I get on traceback on the web page detail under 更明确地说,下面我提到了我在网页详细信息下的追溯上获得的异常详细信息,

/opt/python/run/venv/lib64/python2.7/site-packages/psycopg2/ init .py in connect conn = _connect(dsn, connection_factory=connection_factory, async=async) /opt/python/run/venv/lib64/python2.7/site-packages/psycopg2/ init .py in connect conn = _connect(dsn,connection_factory = connection_factory,async = async)

**Variable  Value** 

database    'xxx' - This is correct

items      [('dbname', 'xxx'), This is correct
           ('user', 'xxxxx'), This is correct
           ('host', 'xxxxxxx.rds.amazonaws.com'), This is correct
           ('port', '5432')]

k          'port'

kwargs     {}

connection_factory  None

dsn        'dbname=xxxx user=xxxx host=xxxx.rds.amazonaws.com port=5432' This is correct

host       'xxxx.rds.amazonaws.com' This is correct

user       'xxxxx'  This is correct

v          '5432' async     False

**password  None** **THIS IT NOT CORRECT**

port       '5432'

cursor_factory  None

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-rds.html http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-rds.html

In your case I woould try going for 就您而言,我应该尝试

  1. Configure your Amazon RDS DB security group to allow access from the Amazon EC2 security group used by your Elastic Beanstalk application 配置您的Amazon RDS DB安全组以允许从您的Elastic Beanstalk应用程序使用的Amazon EC2安全组进行访问

part 部分

Update: don't forget to backslash variables values like RDS_PASSWORD in os environment. 更新:不要忘记在操作系统环境中反斜杠变量值,如RDS_PASSWORD。 Eg export RDS_PASSWORD="pa$$word" should become export RDS_PASSWORD="pa\\$\\$word" 例如, export RDS_PASSWORD="pa$$word"应该成为export RDS_PASSWORD="pa\\$\\$word"

to do this go to; 为此去; on ssh ec2 instance and go to file 在SSH EC2实例上并转到文件

/opt/python/current /选择/蟒蛇/电流

. This dir has one app directory which holds the django app and an env file. 该目录有一个应用程序目录,其中包含Django应用程序和一个env文件。 "nano env" and it shows lot of export statements go to the RDS_PASSWORD line and add the blackslash pass to it. “ nano env”,它显示许多导出语句转到RDS_PASSWORD行,并在其中添加了反斜杠。

export RDS_PASSWORD="pa\\$\\$word". 导出RDS_PASSWORD =“ pa \\ $ \\ $ word”。 Save the file. 保存文件。

Then restart the app on aws and it works like a charm. 然后在aws上重新启动该应用程序,它的工作原理就像一个魅力。

暂无
暂无

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

相关问题 psycopg2.OperationalError:fe_sendauth:未提供密码 - psycopg2.OperationalError: fe_sendauth: no password supplied SQLAlchemy (psycopg2.OperationalError) fe_sendauth:未提供密码 - SQLAlchemy (psycopg2.OperationalError) fe_sendauth: no password supplied Python 和 Postgresql:OperationalError:fe_sendauth:未提供密码 - Python and Postgresql: OperationalError: fe_sendauth: no password supplied django.db.utils.OperationalError:fe_sendauth:迁移 django 应用程序时未提供密码 - django.db.utils.OperationalError: fe_sendauth: no password supplied when migrating django app Django 4 使用密码文件连接到 Postgresql:“fe_sendauth:未提供密码” - Django 4 connection to Postgresql using passfile: "fe_sendauth: no password supplied" PostgreSQL错误-psql:fe_sendauth:未提供密码 - PostgreSQL Error - psql: fe_sendauth: no password supplied fe_sendauth:Composer 中没有提供密码 - fe_sendauth: no password supplied in Composer Django fe_sendauth:未提供密码错误,无法连接到 postgres 数据库 - Django fe_sendauth: no password supplied error, unable to connect to postgres database 使用带有Postgres引擎的AWS Aurora数据库收到“ fe_sendauth:未提供密码”错误,但仅在执行单元测试时出现 - Receiving 'fe_sendauth: no password supplied' error using AWS Aurora database with Postgres engine, but only when performing unit tests Django psycopg2.OperationalError:fe_sendauth错误,但未连接到PostgreSQL数据库 - Django psycopg2.OperationalError: fe_sendauth error but not connecting to postgresql database
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM