Forums

Flask - Something went wrong

I developed a flask application on my machine and I followed the steps of this guide https://help.pythonanywhere.com/pages/Flask

My 'main' in my project looks like this:

if __name__ == '__main__':
    csrf.init_app(app)
    wtf_tinymce.init_app(app)
    mail.init_app(app)
    db.init_app(app)
    with app.app_context():
        db.create_all()
    app.run()

I created a virtual environment 'venv', When I run my 'main.py' on console-bash I get this:

(venv) 02:52 ~/GdeM (master)$ python main.py
Traceback (most recent call last):
  File "main.py", line 305, in <module>
    app.run()
  File "/home/jordanraji/.virtualenvs/venv/local/lib/python2.7/site-packages/flask/app.py", line 841, in run
    run_simple(host, port, self, **options)
  File "/home/jordanraji/.virtualenvs/venv/local/lib/python2.7/site-packages/werkzeug/serving.py", line 691, in run_simple
    s.bind((hostname, port))
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 98] Address already in use

Help!

To run a website on PythonAnywhere, you need to set it up on the "Web" tab. This help page should have everything you need, but if it doesn't answer all your questions, please do post back here.