Git Product home page Git Product logo

youknowwho's Introduction

YouKnowWho

Basic Web project with Python with Flask

Platform

Table of Contents

Summary

The Web basic starter contains an opinionated set of files for web serving:

  • public/index.html
  • public/404.html
  • public/500.html

IBM Cloud Enablement

Requirements

Local Development Tools Setup (optional)

  • If you don't already have it, install Python

IBM Cloud development tools setup (optional)

  1. Install IBM Cloud Developer Tools on your machine
  2. Install the plugin with: bx plugin install dev -r bluemix

IBM Cloud DevOps setup (optional)

Create Toolchain

IBM Cloud DevOps services provides toolchains as a set of tool integrations that support development, deployment, and operations tasks inside IBM Cloud. The "Create Toolchain" button creates a DevOps toolchain and acts as a single-click deploy to IBM Cloud including provisioning all required services.

*Note you must publish your project to Github for this to work.

Configuration

The project contains IBM Cloud specific files that are used to deploy the application as part of an IBM Cloud DevOps flow. The .bluemix directory contains files used to define the IBM Cloud toolchain and pipeline for your application. The manifest.yml file specifies the name of your application in IBM Cloud, the timeout value during deployment, and which services to bind to.

Credentials are either taken from the VCAP_SERVICES environment variable if in IBM Cloud, or from a config file if running locally.

Run

Using IBM Cloud development CLI

The IBM Cloud development plugin makes it easy to compile and run your application if you do not have all of the tools installed on your computer yet. Your application will be compiled with Docker containers. To compile and run your app, run:

bx dev build
bx dev run

Using your local development environment

Running flask applications has been simplified with a manage.py file to avoid dealing with configuring environment variables to run your app.

Usage
python manage.py subcommand [ipaddress]
Subcommands

manage.py offers a variety of different run commands to match the proper situation:

  • start: starts a server in a production setting using gunicorn.
  • run: starts a native flask development server. This includes backend reloading upon file saves and the Werkzeug stack-trace debugger for diagnosing runtime failures in-browser.
  • livereload: starts a development server via the livereload package. This includes backend reloading as well as dynamic frontend browser reloading. The Werkzeug stack-trace debugger will be disabled, so this is only recommended when working on frontend development.
  • debug: starts a native flask development server, but with the native reloader/tracer disabled. This leaves the debug port exposed to be attached to an IDE (such as PyCharm's Attach to Local Process)

There are also a few utility commands:

  • build: compiles .py files within the project directory into .pyc files
  • test: runs all unit tests inside of the project's test directory
Endpoints

Your application is running at: http://localhost:3000/ in your browser.

  • Health endpoint: /health

Debug

Using IBM Cloud development CLI

To build and debug your app, run:

bx dev build --debug
bx dev debug

Using your local development environment

There are two different options for debugging a flask project:

  1. Run python manage.py runserver to start a native flask development server. This comes with the Werkzeug stack-trace debugger, which will present runtime failure stack-traces in-browser with the ability to inspect objects at any point in the trace. For more information, see Werkzeug documentation.
  2. Run python manage.py debug to run a flask development server with debug exposed, but the native debugger/reloader turned off. This grants access for an IDE to attach itself to the process (i.e. in PyCharm, use Run -> Attach to Local Process)

youknowwho's People

Contributors

krejdom avatar

Watchers

 avatar  avatar  avatar

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.