Вопрос

So I have a Python Flask application. With it I'm using flask-restless and flask-sqlalchemy to provide an api. When running on my localhost the api works just fine, however when trying to access the api on the Amazon server(an ec2 instance created with Elastic Beanstalk and eb) the app throws 404 errors.

config.py:

if 'RDS_HOSTNAME' in os.environ:
    SQLALCHEMY_DATABASE_URI = 'mysql://' + os.environ['RDS_USERNAME'] + ':' + os.environ['RDS_PASSWORD'] +'@' + os.environ['RDS_HOSTNAME']  + '/' + os.environ['RDS_DB_NAME']

else:
     SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(_basedir, 'inspections.db')

So I'm using sqlite on my local machine and mysql(RDS) for the server. As a note everything having to do with the database is working. My app is rendering the content and performing queries.

Does anyone know what can be causing this?

Это было полезно?

Решение

Turns out I was running the wrong file on my configuration file. Since my app was setup like a module, I needed to have EC2 run the run.py file and not app/init.py.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top