Forums

Hosting a basic Pyramid app using Python 3

There's a small app I want to host so I figured I would generate an app using a scaffold to make sure I configure things right before filling in the missing pieces. My problem is that I dont know how to get my app running with Python3 instead of 2.

Here is what I have done:

So here's what I've done:

pcreate -s alchemy my_project
python3.3 setup.py develop --user

I then created a file called my_wsgi_file.py that looks like:

def make_application():
    from pyramid.paster import get_app, setup_logging
    ini_path = 'path/to/production.ini'
    setup_logging(ini_path)
    application = get_app(ini_path, 'main')
    return application

And the main wsgi file looks like:

blah blah
from my_project import my_wsgi_file
application = my_wsgi_file.make_application()

When I run the app I get a server error and the error log reports a SyntaxError as I try to import my_wsgi_file that looks a little something like:

 File "/usr/local/lib/python3.3/configparser.py", line 597
2013-03-19 14:21:04,585 :    allow_no_value=False, *, delimiters=('=', ':'),

I used sys.version_info to check which version of Python is being used and it turns out it is 2.7

Can someone please tell me if I have made any errors? And/or give us a step by step guide on how to host a Python3 Pyramis app using PythonAnywhere

We don't support Python 3 for web apps yet. We do have plans to in the future, though. I have upvoted the ticket on your behalf.

Thanks. I assuimed it was available because Python3 is available as a console. It's a little misleading...

It is a bit misleading. We do have an FAQ explaining it, but our FAQ is long and doesn't have an index so it's not surprising you missed it. We're working on improving our online help.

I'm sorry I don't recall if I've upvoted Py3k for web apps. If not, please consider this my vote.

Doesn't look like we did have one for you, a2j -- I've added one.

Thank-you!!

I've really tried to limit the up-votes I cast. People keep having such great ideas. I keep telling myself not to encourage anything until PG is supported, but eh, I just can't help myself...☺

Well, things are finally moving on that front. And you'll be the first to know...

Dare I start dancing (here too) again?

Oh, and THANKS for the good news!!

Is there any news on this? I signed up with PythonAnywhere thinking this was available, and will likely not renew for a second month unless it looks like this will be provided in the near-term. Thanks.

It's really hard to make promises about this. Python 3 support is high up on our list of things to do. It's not that hard either. But, there are a lot of other things we have to do that are very high priority, like moving towards zero-downtime deployments. So I can't promise it will be done by the time your renewal for a second month comes up. But I hope it will.