Flask deployment issue with imports
I followed this guide.
Most of my files are almost identical to the guide (except FlaskApp is changed to the project name HopUpon). except for
__init__.py which looks like this:
from flask import * import json #import airport_finder2 #import pandas as pd app = Flask(__name__) @app.route('/') def index(): return render_template('quicksearch.html') if __name__ == '__main__': app.run(debug=True)
This file works but when I uncomment airport_finder2 or pandas as pd I am unable to reach the website. It endlessly searches.
some background on airportfinder2:
this is a python file which searches through two csv files and returns a result.
These files are located in the same folder as`“ _init__.py”` - /var/www/HopUpon/HopUpon
but I would like to move them to /var/www/HopUpon/HopUpon/static once I can get them working.
I have pip installed pandas on to the virtual environment.
I have tried to create a log but I get an internal server error when I do.
import logging logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)-8s %(message)s', datefmt='%a, %d %b %Y %H:%M:%S', filename='/temp/myapp.log', filemode='w') logging.debug('A debug message')
So I have no error logs to show. Apologies. I know it would make it much easer.
Why are these imports giving errors?
What errors are they giving?
How do I run my Flask app in debug mode on digitalocean?
Any help will be greatly appreciated.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×