Skip to content

SonyaCore/simple-flask-blog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Flask Blog

Contributors Forks Stargazers Issues

Simple Flask Blog is a blog written with flask & jinja

Setup Project :


Using Dockerfile

First of all fill all required ENV for Dockerfile

ENV SECRET_KEY='YOUR SECRETKEY'
ENV SQLALCHEMY_DATABASE_URI='sqlite:///site.db'

ENV MAIL_SERVER='SMTP MAIL SERVER'
ENV SMTP_PORT='SMTP PORT'

ENV MAIL_USERNAME='SMTP USER'
ENV MAIL_PASSWORD='SMTP PASS'

Save Dockerfile . then build image

docker build -t flask-app:1.0 .

Now run image :

docker run -p 80:80 flask-app:1.0

Without Docker (Advanced Way)

First you need to Create a VENV for the Project Open a Terminal in Project Directory and use Below line to Create VENV:

python3 -m venv venv

Now you have to Activate VENV
For Activating VENV use below line :

Linux/macOS:
source venv/bin/activate
Windows:
venv/Scripts/activate.ps1

After Activating VENV you have to install requirements.txt

pip3 install -r requirements.txt

Set Environment Variables:

export SECRET_KEY='Your Secret Key'
export SQLALCHEMY_DATABASE_URI='sqlite:///site.db'
export MAIL_SERVER='SMTP Server URL'
export SMTP_PORT='SMTP PORT'
export MAIL_USERNAME='SMTP USERNAME'
export MAIL_PASSWORD='SMTP PASSWORD'
Note:

save above exports to .bashrc for holding the values to your default shell.

Initial Database and admin user :

python3 dbinit.py
Note:

Before using above command make sure to edit dbinit.py for changing blogname , navbar and admin information to your needs.

Run Project :

Enter this command in the terminal to run the project :

python3 -m flask run --port 80

Now enter the given address in the URL bar of your browser:

http://127.0.0.1:80/
Note:

Default admin username and password are :

Email : admin@gmail.com  
Password : admin

Config Project :

Open app/config.py with you desired editor.

if you want to disallow anyone to register and write post change :

USER_REGISTER = True
to False.


This Project are still in development so i wrote a todo list to track the Progress

Todo List

  • Better Structure of Application
  • Add Database to Application
  • Add A Way To Create,Update,Delete Posts with Privileged User
  • User Account , Profile Picture
  • User Password Encryption (brcypt method used)
  • A Better Post Edit Section with Markdown or JS
  • Code Refactoring & Cleaner Code
  • Blueprints
  • Custom Error Pages
  • Cache Exeptions to Show Error Pages
  • Dockerfile