Forums

flask_app.py is overwritten

My previous flask_app.py woked fine. However, when I added one more application, the flask_app.py code was overwritten. Now I couldn't figure out what code I should put there.

My main code is in the directory of into_to_flask directory, where I have _init.py and routines.py. If I put below two lines in the flask_app.py:

from   intro_to_flask import app


app.run(debug=True)

I get error message like:

2014-12-02 04:16:08,820 :Traceback (most recent call last):
2014-12-02 04:16:08,820 :  File "/bin/user_wsgi_wrapper.py", line 130, in __call__
2014-12-02 04:16:08,820 :    self.error_log_file.logger.exception("Error running WSGI application")
2014-12-02 04:16:08,820 :  File "/usr/lib/python2.7/logging/__init__.py", line 1185, in exception
2014-12-02 04:16:08,821 :    self.error(msg, *args, **kwargs)
2014-12-02 04:16:08,821 :  File "/usr/lib/python2.7/logging/__init__.py", line 1178, in error
2014-12-02 04:16:08,821 :    self._log(ERROR, msg, args, **kwargs)
2014-12-02 04:16:08,821 :  File "/usr/lib/python2.7/logging/__init__.py", line 1270, in _log
2014-12-02 04:16:08,821 :    record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info, func, extra)
2014-12-02 04:16:08,821 :  File "/usr/lib/python2.7/logging/__init__.py", line 1244, in makeRecord
2014-12-02 04:16:08,822 :    rv = LogRecord(name, level, fn, lno, msg, args, exc_info, func)
2014-12-02 04:16:08,822 :  File "/usr/lib/python2.7/logging/__init__.py", line 284, in __init__
2014-12-02 04:16:08,822 :    self.threadName = threading.current_thread().name
2014-12-02 04:16:08,822 :  File "/usr/lib/python2.7/threading.py", line 1160, in currentThread
2014-12-02 04:16:08,822 :    return _active[_get_ident()]
2014-12-02 04:16:08,822 :  File "/bin/user_wsgi_wrapper.py", line 122, in __call__
2014-12-02 04:16:08,822 :    app_iterator = self.app(environ, start_response)
2014-12-02 04:16:08,822 :  File "/bin/user_wsgi_wrapper.py", line 136, in import_error_application
2014-12-02 04:16:08,822 :    raise e
2014-12-02 04:16:08,823 :OSError: [Errno 2] No such file or directory

Please help me out. Thanks.

[edit by admin: formatting]

Hi there -- can I take a look at your code? (We can always see if from our side, but we never look without explicit permission from you.)

Thanks. I fixed it.

from intro_to_flask import app if name == 'main': app.run(debug=True)

This if sentence was missing.

Ah, right -- yes, that would definitely cause problems. Glad you got it working!