Forums

Help run web2py using python3

Hi Everybody

I am new here on PythonAnywhere. I just started to use web2py and found it is running with python 2. How can I config it to use python 3?

Thanks in advance

-cook

Hi there, web2py isn't compatible with python 3 as far as I know. https://www.pythonanywhere.com/forums/topic/2103/#id_post_13681

You can do it if you download the latest web2py from git repository: http://github.com/web2py/web2py/

I actually run web2py with py3 on PythonAnywhere, but web2py and pydal are still buggy.

are there some good instructions for how to do this stuff somewhere?

I can tell how I did:

Go to https://www.pythonanywhere.com/user/your_name/webapps:

  • Add a new web2py app into ~/dev/. PythonAnywhere will do all the work with uswgi settings and so on
  • Set Python version 3.6 to run web2py (and setup virtualenv with py3 if needed)

Go to bash and replace web2py:

cd ~/dev

rm -rf web2py

git clone --recursive https://github.com/web2py/web2py.git

Setup your web2py admin password for port 443 (run python3 in web2py environment):

python3 web2py.py -S welcome

.

from gluon.main import save_password

save_password('your_password', 443)

That's all