https://github.com/sonyacore/simple-flask-blog
Simple flask blog
https://github.com/sonyacore/simple-flask-blog
blog flask html-css jinja2 python sqlalchemy
Last synced: about 1 year ago
JSON representation
Simple flask blog
- Host: GitHub
- URL: https://github.com/sonyacore/simple-flask-blog
- Owner: SonyaCore
- Created: 2022-09-13T05:02:15.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-13T21:15:00.000Z (over 3 years ago)
- Last Synced: 2025-03-27T22:11:48.153Z (about 1 year ago)
- Topics: blog, flask, html-css, jinja2, python, sqlalchemy
- Language: HTML
- Homepage:
- Size: 127 KB
- Stars: 4
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Simple Flask Blog
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
Simple Flask Blog is a blog written with flask & jinja
Setup Project :
---
Using Dockerfile
First of all fill all required ENV for Dockerfile
```docker
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
```sh
docker build -t flask-app:1.0 .
```
Now run image :
```sh
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:
```bash
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 :
```python
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 :
```text
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
- [x] Better Structure of Application
- [x] Add Database to Application
- [x] Add A Way To Create,Update,Delete Posts with Privileged User
- [x] User Account , Profile Picture
- [x] User Password Encryption (brcypt method used)
- [ ] A Better Post Edit Section with Markdown or JS
- [x] Code Refactoring & Cleaner Code
- [x] Blueprints
- [x] Custom Error Pages
- [x] Cache Exeptions to Show Error Pages
- [x] Dockerfile
[contributors-shield]: https://img.shields.io/github/contributors/SonyaCore/simple-flask-blog?style=for-the-badge
[contributors-url]: https://github.com/SonyaCore/simple-flask-blog/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/SonyaCore/simple-flask-blog?style=for-the-badge
[forks-url]: https://github.com/SonyaCore/simple-flask-blog/network/members
[stars-shield]: https://img.shields.io/github/stars/SonyaCore/simple-flask-blog?style=for-the-badge
[stars-url]: https://github.com/SonyaCore/simple-flask-blog/stargazers
[issues-shield]: https://img.shields.io/github/issues/SonyaCore/simple-flask-blog?style=for-the-badge
[issues-url]: https://github.com/SonyaCore/simple-flask-blog/issues