python - AWS - DJANGO - Error in formatting: OperationalError: fe_sendauth: no password supplied -


i have setup django app on aws beanstalk postgresql 9.4.7. database settings 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.

aws application installation completed when opened index page received following error.

exception type: runtimeerror exception value:     error creating new content types. please make sure contenttypes migrated before trying migrate apps individually. 

further digging exception page found error

**variable**     my_list   **value** error in formatting: operationalerror: fe_sendauth: no password supplied  **request**  <wsgirequest: '/new/'> 

my_list variable defined in index page view.

further down page can see db values updated correctly.

to check if there issue password tried accessing aws rds via pgadmin , able no issues there.

i have tried lot of things not able find solution need assistance please.

edit: have checked tables after connecting pgadmin , can confirm tables have been created through migrate command (created in aws .config file) on aws database. thought of sharing in case helpful.

edit 2: on error page if go down settings section can see both id , password reflecting (pass in ******** form). in traceback section can see password none rest of info there , 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: db except password , checked env file found in /opt/python/current on aws ssh instance , found had export settings correctly listed including password.

to more explicit, below have mentioned exception detail on traceback on 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)

**variable  value**   database    'xxx' - correct  items      [('dbname', 'xxx'), correct            ('user', 'xxxxx'), correct            ('host', 'xxxxxxx.rds.amazonaws.com'), correct            ('port', '5432')]  k          'port'  kwargs     {}  connection_factory  none  dsn        'dbname=xxxx user=xxxx host=xxxx.rds.amazonaws.com port=5432' correct  host       'xxxx.rds.amazonaws.com' correct  user       'xxxxx'  correct  v          '5432' async     false  **password  none** **this not correct**  port       '5432'  cursor_factory  none 

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

in case woould try going

  1. configure amazon rds db security group allow access amazon ec2 security group used elastic beanstalk application

part

update: don't forget backslash variables values rds_password in os environment. eg export rds_password="pa$$word" should become export rds_password="pa\$\$word"

to go to; on ssh ec2 instance , go file

/opt/python/current

. dir has 1 app directory holds django app , env file. "nano env" , shows lot of export statements go rds_password line , add blackslash pass it.

export rds_password="pa\$\$word". save file.

then restart app on aws , works charm.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -