command: pip install virtualenv
command: virtualenv <venv_name>
https://medium.com/@asusrishabh/requirements-txt-in-python-947b0b43bbe6
- use requirements.txt to install compatible packages
command: pip install -r requirements.txt
- To run flask server
command: python main.py
-
Configure Environment Variables
cd Blog_Site # Edit .env file and replace [YOUR-PASSWORD] with your database password nano .env # or use any text editor
-
Initialize Database
conda run -n blogsite python init_supabase_db.py
-
(Optional) Migrate Existing SQLite Data
# Backup SQLite first cp database.sqlite3 database.sqlite3.backup # Run migration conda run -n blogsite python migrate_sqlite_to_supabase.py
-
Start Application
conda run -n blogsite python main.py
Access at: http://localhost:8080
Simply remove or rename the .env file, and the application will use SQLite automatically:
cd Blog_Site
mv .env .env.backup
python main.pyBloglite is a simple blog application like Instagram, twitter or Linkedin, It is a multi user app with
login, feed, post/blog, with various features like follow/unfollow, edit profile/post and search.
This consist of two APIs for CRUD operation on USER and BLOG/POST
- Technologies used
- Python (Programming Language)
- Flask (Web Framework)
- HTML (HTML Doc.)
- Bootstrap (Frontend)
- Flask-RESTful==0.3.9 (RESTAPIs)
- Flask-SQLAlchemy==3.0.2 (SQLite connection)
- Jinja2==3.1.2 (HTML injection)
- SQLAlchemy==1.4.45 (SQLite connection)
- Werkzeug==2.2.2 ( To secure file)
- For UserAPI
GET:- localhost:8080/users/{userid}
POST:- localhost:8080/users/
PUT:- localhost:8080/users/{userid}
DELETE:- localhost:8080/users/{userid}
- For POST/BLOG_API
GET:- localhost:8080/posts/{postid}
POST:- localhost:8080/posts/
PUT:- localhost:8080/posts/{postid}
DELETE:- localhost:8080/posts/{postid}
└── Blog Site
├── static
├── templates
├── api.py
├── main.py
├── controller.py
├── model.py
├── requirements.txt
├── database.sqlite3
