简体   繁体   中英

After cloning my Flask app to my new computer I can not get it to run

I am building a Flask app to create a peer to peer market place. I am having trouble getting the code running on my new computer. The code can be found here: https://github.com/ripemelon/flaskbyge .

flaskbyge$ python run.py
/home/byge/.local/lib/python2.7/site-packages/flask_sqlalchemy/__init__.py:834: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future.  Set it to True or False to suppress this warning.
  'SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and '
Traceback (most recent call last):
  File "run.py", line 1, in <module>
    from flaskbyge import app
  File "/home/byge/Desktop/flaskbyge/flaskbyge/__init__.py", line 15, in <module>
    from flaskbyge import routes
  File "/home/byge/Desktop/flaskbyge/flaskbyge/routes.py", line 33
    flash(f'Account created for {form.username.data}! You can now log in','success' )***

It gives me this error when I try to run the Flask module using the SQLAlchemy database.

You are using Python2.7 as you can see in the first line of your error message. It seems that this app is developed for at least Python3.6, because formatted strings are used as you can see in the last line ( flash(f'Account ...) ).

This works for me:

$ cd $ROOT_FOLDER_OF_YOUR_APP
$ python3.8 -m venv flaskbyge
$ source flaskbyge/bin/activate
$ pip install -r requirements.txt
$ python run.py

For me python3.8 is clearly running the Python3.8 interpreter. The command can be different for you, maybe python3 or similar. Maybe Python3.6 is enough. Note, that after activating the virtual environment, the python and pip command refers to the right Python version (here Python3.8).

All after all, it seems that you only have to ensure that you don't start the app via Python2.7.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM