This is a flask blogging engine for publishing articles. A live implementation will be made available at Equimolar.com in the coming weeks. Here, will be going through the following in the content:
I wanted to build a blog for publishing articles and some python programmes, thus, I may have a hard time using wordpress, which sounds like the simplest, in conjunction with my python codes. Why not fork one of the python-blog repos? After trying out alot of them, read more in the next section, none of them seems to solve my needs as stated below.
The needs that call for the development of the flask blog app, are listed below. Obviously, if this are not the features you needed, you may simply jump to the next section to see other available options built by some brilliant people, in fact there are alot out there you can pick from, so feel free to explore alot of other brilliant options out there depending on your needs.
There are currently a gazillion number of already available python blog frameworks like, Flask-Blog, Flask-Blogging, Simple-Flask-Blog, and Weblog, which are all brilliant, but based on my needs, there is no single that ever address all my problems. For example, after trying out several of them, I short listed two, which were Flask-Bloogging and Weblog.
Equimolar-Blog was built based on the knowledge gained by trying out several of the programmes discussed earlier, just that they were modified to suit the needs. Equimolar-Blog is Flask blog solution that solves all the previously stated requirements using the simplest method possible. dependent upon a list of several publicly available codes:
cd into the folder, on windows something like
C:\Users\Ewetoye Ibrahim>>
cd C:\path to the folder\Equimolar-Blog
[Optional] Create a virtual environment and activate it
Install the requirement file: python -m pip install requirement.txt
[Optional] If you have change the database to something else other than sqlite3 configured, you should first make sure that the database exist, even if blank. But it is well-known that this is not required for sqlite3 databases as it will be created on the fly if not found at the specified location
Test mode:
Setup the database. something like:
C:\path to the folder\Equimolar-Blog>>
python create_db.py
Note: this should only be done on a test database; Never run this on procuction database!!!
This step creates all the tables in the model; create the three rights (Authour, Editor, and Registrar); adds four dummy users:
Username | Password | Rigth(s) | |
---|---|---|---|
Authour User | authour@example.com | password | Authour |
Editor User | editor@example.com | password | Editor |
Registrar User | registrar@example.com | password | Registrar |
Owner User | owner@example.com | password | Authour, Editor, Registrar |
As such, the create_db.py file should be run on a production database, as it will create the afore-mentioned usersin the database.
Start the app from the command prompt: python run.py
Now, your blog should be live at 127.0.0.1:5000
Production mode: There are two basic ways here: set the environment variable or type into run.py directly:
Set the env variable:
set CONFIG_NAME=production
set FLASK_APP=run.py
flask run
Hardcode directly into run.py:
Open run.py
Edit the third line.
from
app = create_app(os.getenv('CONFIG_NAME', default='default'))
to
app = create_app('production')
Do python run.py
Visit /writter endpoint. e.g localhost:5000/writter
Visit the article, if you are either the one who posted the article or you have an Editor rigth, you will get to see an edit button at the top of article, click it and edit as needed.
First Released: 1/1/2020 by Ewetoye, Ibrahim