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.
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.
- 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!
For example, you can deploy the site on Heroku, with GitHub integration.
-
Create a new app on Heroku with GitHub deployment method.
-
Do not forget about Procfile:
web: python3 server.py
-
Add your environment variables to Settings > Config Vars section (FLASK_DEBUG and PORT). Use PORT=80
-
Open https://[your-app-name].herokuapp.com/ in your browser
-
For reading logs install Heroku CLI, log in and use:
$ heroku logs -t --app app-name
The code is written for educational purposes. Training course for web-developers - DEVMAN.org