Forums

change python version for website

Hi, I want to change the python version for mysite, how can i do this from the dashboard? Help...

You can delete your web app and start again with a different python version. Don't worry, we don't delete your code, so you'll be able to copy across anything that you think will work in a different python version... Or if you use manual config, and copy some of the details from your old wsgi file (we save it with a .bak extension), you can even set up the exact same app, if you think it'll work...

That's not 100% true. If you delete and then set up a new Flask app, it will overwrite your flask_app.py. So make backups first.

good point!

Aside from deleting and recreating the entire web app, is there still no way around this? What's the reason why we can't upgrade the python version more easily? (Maybe this is a newb question...)

there's no good reason, no, we just haven't built the UI components for it. I'll add a +1 in the tracker.

In the meantime, deleting and re-creating your web app shouldn't be difficult -- it's not a matter of deleting your files, just the config at our end, and the wsgi file...

I'm in the same boat. I want to switch my web app to Python 3. I noticed that when I click on "Web" at the top, and then scroll down to "Code", I see "Python version" and beside that, a pencil icon. I clicked the pencil icon and then changed it to Python 3. Is that sufficient (aside from changing my web app's Python code to make it compatible with Python 3)? Or do I still need to delete the web app and/or mess around with config files?

You could change what python version is being run for your webapp. However, this is just what we use to run your code. Your code might break from this change and you would have to fix it yourself. I would not really recommend doing that for a python2.7 -> python3 change, but perhaps for a python3.4 -> python3.5 change.

Also, be sure to change your virtualenv/re-install any packages needed.