Fireblog
A simple blog, written in Python, using the Pyramid web framework. For a live version, see my blog.
Note that this project, whilst being used for my website hasn't been made fully ready to be used on any website. In other words, I hope to make it easier and quicker to setup and manage the website, as well as upgrade it. Hopefully soon.
Getting Started
First make sure there is a running local instance of redis. Then run the following commands:
git clone https://github.com/ismail-s/fireblog.git
cd fireblog
pip install -r requirements.txt
python setup.py develop
initialize_fireblog_db development.ini
mkdir reload-spooler
uwsgi --ini-paste-logged development.ini
Do note when running those commands that:
- you use a virtualenv
You don't use development.ini when running in production. This is because development.ini enables the debug toolbar, which allows arbitrary code execution. For a warning of what this could result in, see this article.
If you want to run the server in production mode as a daemon, then run:
uwsgi --ini-paste-logged production.ini
If you wish to customise stuff, eg use a database like postgres instead of sqlite (the default), then change the .ini file you pass to these commands.
Managing the database
The initialize_fireblog_db
script does 4 things when run:
- Creates the db with the required tables if they don't exist already
- Updates the db to the latest version if necessary
- Creates a first post if no posts exist already
- Makes sure all required settings are in the settings table, prompting the user of the script to input values if a value doesn't exist or is invalid.
This means that this script doesn't accept any parameters besides the ini
file which says where the db is. The script is also safe to run at any
point, to either create, update or check the db. So, at the moment, the way
the website can be updated is by doing a git pull
to get the latest code,
taking down the webiste, running the initialize_fireblog_db
script and
then starting the website again.