GithubHelp home page GithubHelp logo

tolorun / flack Goto Github PK

View Code? Open in Web Editor NEW

This project forked from miguelgrinberg/flack

0.0 2.0 0.0 61 KB

Companion code to my PyCon 2016 "Flask at Scale" tutorial session.

License: Other

Python 62.88% JavaScript 21.42% CSS 10.56% HTML 4.82% Shell 0.32%

flack's Introduction

Flask At Scale Tutorial at PyCon 2016

This repository contains the companion code to my PyCon 2016 "Flask At Scale" class.

IMPORTANT NOTE: The initial commit in this repository has a version of this application that has a few scalability problems discussed during class. These problems are addressed in subsequent commits.

Installation

All the code and examples were tested on Python 3.5. Older versions of Python including 2.7 will likely work as well.

As usual, create a virtual environment and install the requirements with pip.

pip install -r requirements.txt

Running

The application uses Flask-Script to simplify common tasks such as starting a development server. To run the application run the following command:

python manage.py runserver

You can add --help to see what other start up options are available.

The second component of this application is the Celery workers, which must be started with the following command:

python manage.py celery

If you want to have more verbose output from the workers you can add --loglevel=info to the command above.

Finally, in addition to the main server and the Celery workers, a message queue must be available to be used for communication between all these processes. By default, a Redis server running on localhost on the default port is assumed. If you want to use a different message queue, or a different configuration for Redis, then set the CELERY_BROKER_URL environment variable to the message queue connection URL. See the Celery documentation for information on connection URLs.

Usage

That application allows multiple users to chat online. You can launch the application on your browser by typing http://127.0.0.1:5000 on the address bar.

Since authentication is not a topic in this class, I've decided to use a simplified flow that combines the registration and login forms in one. If you are a new user, enter your chosen nickname and password to register. If the nickname was not seen before the server will register you. If you are a returning user, provide your login in the same form. If the nickname is registered then the password will be validated.

Once you are logged in you can type messages in the bottom text entry field, and these messages will be seen by all other users. You can use simple MarkDown formatting to add style to your messages. If you enter any links as part of your message, these will be shown in expanded form below the message.

flack's People

Contributors

miguelgrinberg avatar

Watchers

Oluwaseun Omotosho avatar James Cloos 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.