Skip to content

Latest commit

 

History

History
74 lines (42 loc) · 1.7 KB

README.md

File metadata and controls

74 lines (42 loc) · 1.7 KB

Telegraph Clone

This site is a simple service for publish anonymous articles, like telegra.ph. Any user can creates an article and gets unique user-friendly url for it. User can edits articles without login and password (authorization works with sessions). Every article stores in txt-file.

How to Install

Python 3.6 and libraries from requirements.txt should be installed.

$ pip install -r requirements.txt

Put all necessary parameters to .env file.

FLASK_DEBUG=TRUE
PORT=8000
HOST=0.0.0.0
SECRET_KEY=your_secret_key
ARTICLES_DIR=articles_dir_name
ARTICLES_EXT=.txt

FLASK_DEBUG environment variable Flask loads by itself, but for PORT loading we should use python-dotenv package.

Quickstart

  1. Run server.py.
$ python server.py

 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with inotify reloader
 * Debugger is active!
  1. Goto http://127.0.0.1:8000/

How to Deploy

For example, you can deploy the site on Heroku, with GitHub integration.

  1. Create a new app on Heroku with GitHub deployment method.

  2. Do not forget about Procfile:

web: python3 server.py
  1. Add your environment variables to Settings > Config Vars section (FLASK_DEBUG and PORT). Use PORT=80

  2. Open https://[your-app-name].herokuapp.com/ in your browser

  3. For reading logs install Heroku CLI, log in and use:

$ heroku logs -t --app app-name

Project Goals

The code is written for educational purposes. Training course for web-developers - DEVMAN.org