Git Product home page Git Product logo

os-sample-python's Introduction

Flask Sample Application

This repository provides a sample Python web application implemented using the Flask web framework and hosted using gunicorn. It is intended to be used to demonstrate deployment of Python web applications to OpenShift 3.

Implementation Notes

This sample Python application relies on the support provided by the default S2I builder for deploying a WSGI application using the gunicorn WSGI server. The requirements which need to be satisfied for this to work are:

  • The WSGI application code file needs to be named wsgi.py.
  • The WSGI application entry point within the code file needs to be named application.
  • The gunicorn package must be listed in the requirements.txt file for pip.

In addition, the .s2i/environment file has been created to allow environment variables to be set to override the behaviour of the default S2I builder for Python.

  • The environment variable APP_CONFIG has been set to declare the name of the config file for gunicorn.

Deployment Steps

To deploy this sample Python web application from the OpenShift web console, you should select python:2.7, python:3.3, python:3.4 or python:latest, when using Add to project. Use of python:latest is the same as having selected the most up to date Python version available, which at this time is python:3.4.

The HTTPS URL of this code repository which should be supplied to the Git Repository URL field when using Add to project is:

If using the oc command line tool instead of the OpenShift web console, to deploy this sample Python web application, you can run:

oc new-app https://github.com/OpenShiftDemos/os-sample-python.git

In this case, because no language type was specified, OpenShift will determine the language by inspecting the code repository. Because the code repository contains a requirements.txt, it will subsequently be interpreted as including a Python application. When such automatic detection is used, python:latest will be used.

If needing to select a specific Python version when using oc new-app, you should instead use the form:

oc new-app python:2.7~https://github.com/OpenShiftDemos/os-sample-python.git

os-sample-python's People

Contributors

grahamdumpleton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

os-sample-python's Issues

Give instructions for creating an app from a local clone

I set up a new project using this one as a template, but it took me a bit of thought to realise the right way to do a deployment based on that.

  1. Push the imported sample code up to the source repo

  2. Use that source repo in the deployment command rather than deploying directly from the local system:

    oc new-app python:3.5~https://github.com/ncoghlan/srpminfo.git

That way the deployed app is correctly associated with the relevant source repo.

Config.py clarification

Apologies for another question posted as an issue, though perhaps useful to others (maybe?)--any info/resources for config options in the config.py file?

The syntax seems designed for the OpenShift environment with lines like these: threads = int(os.environ.get('GUNICORN_THREADS', '1'))

How do I set error log levels (really the question I'm after)? My app is getting to the "booting worker with pid" step but then must be throwing some error but not reporting it.

Thanks again.

Update pip?

I realize this is slightly OT, but what is the best way to implement this project but update pip before it launches? My script requires dependencies that require pip 8.1, but default on the server is 7.x.

newer version? operator backed version?

I asked at my employer about this repo, to which they stated it is quite old.. and not the current way of working to ascribe to.. I want to learn how to create operators in openshift and failing to find any simple example of that anywhere.. could I in theory start here and tack on operators after I get this working.. so far I have gotten simple nodejs projects and java webapps to launch in a helloworld project on openshift but wondering more about python.. and docker webapps...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.