Coder Social home page Coder Social logo

usr-workshop's Introduction

User Self Registration App

How to use this repo to build your own application

  1. Fork this repository into your own Git repo
    • This will create a copy that you will own
  2. Log into OpenShift
  3. Select the project in which you want to add an application
    • There will be a dropdown of projects you have permissions to
  4. Go to the catalog and select 'python' to create a new python application
  5. Enter the app name and the URL for the app's repository (from step #1),
  6. Click 'Create'

Local development

Create virtual environment, activate, and install dependencies

python -m venv .venv
. ./.venv/bin/activate

pip install -U pip
pip install -r requirements.txt

Run w/ python _main_

python wsgi.py

OR

Run w/ gunicorn (s2i python container does this)

gunicorn wsgi:application -c config.py

Access via http://localhost:8080/

WSGI / gunicorn

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 behavior 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.

See https://github.com/OpenShiftDemos/os-sample-python

More information about this project

This repo contains a Dash application that can be deployed to OpenShift using Source to Image (S2I). Here are the main files:

  1. The Dash Application (learn about Dash HERE )

    • wsgi.py; main application, to be run by gunicorn
  2. The S2I environment variables. Used to setup additional environment varibles (ex: setup packages using a Nexus repository)

    • .s2i/environment
  3. This file contains the dependencies that the application needs to run

    • requirements.txt

    One way to create a requirements file for your application is by running the following:

    pip freeze > requirements.txt
    

How it works

The file wsgi.py contains the instructions for python to run Dash.

When s2i builds the container, it will look into .s2i for additional instructions, including environment variables for installing packages with pip.

Links

usr-workshop's People

Contributors

codekow avatar willtome avatar brady-spiva avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

willtome

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.