GithubHelp home page GithubHelp logo

nikhilpandey-dev / manning_twitch_presentation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from writeson/manning_twitch_presentation

0.0 0.0 0.0 367 KB

Example code to go along with the Manning Twitch Presentation I'll be giving on 2021-11-12

Python 1.54% HTML 10.25% CSS 86.76% JavaScript 0.70% Jinja 0.75%

manning_twitch_presentation's Introduction

The Well-Grounded Python Developer Twitch Presentation

The code in this repository goes along with the Twitch presentation. Each example expands on the previous one to illustrate ways to make your Flask web development work easier and more maintainable.

Installation

The examples in this repository were built and run against Python 3.9.6. I would recommend using the pyenv utility to install and manage installing and using that version of Python to avoid conflicting with any system installed Python.

There is a port of pyenv for windows you can find here. However, I haven't tried it, so your mileage may vary.

Once you have pyenv installed, install the 3.9.6 version of Python with this command in a terminal:

$ pyenv install 3.9.6

To create a Python virtual environment in the directory where you've cloned this repo take the following steps from a terminal command line once pyenv is installed:

$ cd <folder where you've cloned the repo>
$ pyenv local 3.9.6
$ python -m venv .venv
$ source .venv/bin/activate
$ python pip install --upgrade pip
$ pip install -r requirements.txt

These steps will create and activate a Python 3.9.6 virtual environment in the directory where you've cloned the repo. It will also install the necessary modules (Flask) to run the example applications.

To deactivate the Python virtual environment enter the command from the terminal:

$ deactivate

Running The Examples

To run the example applications you must activate the Python 3.9.6 virtual environment with this command from a terminal in Mac or Linux:

$ source .venv/bin/activate

Then set some environment variables that are used by Flask:

$ export FLASK_APP=myapp.py
$ export FLASK_ENV=development
$ export FLASK_DEBUG=1

To run a particular example application move to the folder in the example folder containing the myapp.py file and enter this command from a terminal:

$ flask run

This command will start the Flask development server. You can open a browser to localhost:5000 to navigate to the web application. The CTRL-C key combination in the terminal window will exit the Flask server.

Examples

  1. Is similar to most of the "Hello World" Flask examples you might have seen
  2. Demonstrates a better starting point from which to grow and expand your Flask applications. This also includes using a template file that adds the inclusion of the Bootstrap framework.
    1. The versatility of this starting point will be shown in later examples
  3. Shows creating more complex web pages
  4. Shows how to use Jinja2 templates and template inheritance to manage complex web pages
  5. Makes use of Flask Blueprints to namespace and modularize your web applications features. Also added Blueprint specific styling and JavaScript.
  6. Modifies the previous example to create a database, move the content into the database and use it to build the content page.

manning_twitch_presentation's People

Contributors

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