The OpenShift forums have been retired.
You can still read and search them, but for help, please visit help.openshift.com.

How to make Python front end

I have created a new application based on the Python gear.

No problems so far runing Python modules, uploading using git or using standard bash commands.

The thing I struggle to get is what files are displayed in the web frontend while I type the uri to my app.

I can see wsig/static/ displays static html and that wsgi/application obviously is displayed as a parsed python file whe I request the web root of the app. But how do I do if I want to show the python file myapp-myname.openshift.com/secondpage.py

Can´t really wrap my head around what files are served and where I controll that.

I have previous experience in php and jsp and to me they seem a bit more straight forward as you can just call the name of the file you want to display.

Regards

/E

What version of Python did you install?

Our Python 2.6 and 2.7 cartridges are wsgi-based: http://webpython.codepoint.net/wsgi_tutorial
You will want to define handlers for each. For example, the default application (repo/wsgi/application) handles /health and /env specifically and generically for everything else:

def application(environ, start_response):
 
    ctype = 'text/plain'
    if environ['PATH_INFO'] == '/health':
        response_body = "1"
    elif environ['PATH_INFO'] == '/env':
        response_body = ['%s: %s' % (key, value)
                    for key, value in sorted(environ.items())]
        response_body = '\n'.join(response_body)
    else:
        ctype = 'text/html'
...

You can override that with repo/app.py and use something like cherrypy if you wanted to (see app.py.disabled as an example). Otherwise, it's hardcoded to serve repo/wsgi/application by default.