Debug Flask with complicated project structure Follow
I'm new to debugging flask with pycharm, so hopefully nothing I ask is too trivial.
I have two files
code/__init__.py and code/runserver.py
In the __init__ file is the where my Flask app is initialized meaning that is where the statement :
occurs.
In the runserver.py file is where I have the statement
The runserver imports the app in the following manner :
Inside of the main function are a number of parser.addoption commands and then ultimately
In this case what would my entry point for debugging the application be?
I assumed it would be runserver.py but when I attempt to debug this I get the response of
ImportError: No module named code
If however I run it like
I don't have any issue.
I have two files
code/__init__.py and code/runserver.py
In the __init__ file is the where my Flask app is initialized meaning that is where the statement :
app = Flask(__name__)
occurs.
In the runserver.py file is where I have the statement
if __name__ == '__main__': main()
The runserver imports the app in the following manner :
from code import app, __app_name__, __version__
Inside of the main function are a number of parser.addoption commands and then ultimately
def main(): parser = OptionParser() parser.add_option("-d","--debug",action="store_true",default=app.config.get('DEBUG',True),dest="debug",help="Turn on debugging") (options,args) = parser.parse_args() app.run(debug=options.debug,host=options.address,port=options.port)
In this case what would my entry point for debugging the application be?
I assumed it would be runserver.py but when I attempt to debug this I get the response of
ImportError: No module named code
If however I run it like
python ${BASE}/code/runserver.py
I don't have any issue.
Please sign in to leave a comment.
First my project directory was not actually named 'code' I had just listed it as that for sanitization purposes.
I'd prefer not too download the EAP for stability purposes.
One piece of information I forgot to include in my initial report was that I am running in a virtualenv. My issue seems to be identical to the one posted here : http://stackoverflow.com/questions/10437661/importerror-no-module-named-test-data-but-test-data-py-in-same-directory-as-te
I chose to add my 'code' directory as source in my project interpreter settings and that resolved my issue.
If I run across anything else I'll download the EAP