Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nchimunyascripts/pyhton-flask
https://github.com/nchimunyascripts/pyhton-flask
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/nchimunyascripts/pyhton-flask
- Owner: nchimunyascripts
- Created: 2023-05-12T14:54:23.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-05-12T15:01:05.000Z (over 1 year ago)
- Last Synced: 2024-01-27T09:26:25.800Z (10 months ago)
- Language: HTML
- Size: 7.41 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WEB WITH FLASK
Flask is apyhton flamework that makes it easy to write websites### Prerequites
- python installed on your machine
- bootstrap
- css
- html```
web-python/
| app.py
|
|___static/
| |____css/
| | | style.css
| |
| |____img/
| | img.jpg
|
|
|___templates/
| | index.html
| | about.html
| | create.html
| | edit.html
| | post.html
|
| init_db.py
| schema.sql
```
## USAGEcreate a virtual enviroment using this command
## Windows uses
python -m venv [name_of_your_venv]
then
[name_of_your_venv]\Scripts\activate
now install flask in your virtaul enviroment:
pip install flask
## Linux or MacOS
python3 -m venv [name_of_your_venv]
then
source [name_of_your_venv]/bin/activate
now install flask in your virtaul enviroment:
pip3 install Flask
### Query Single Post
```python
def get_post(post_id):
conn = get_db_connection()
post = conn.execute('SELECT * FROM posts WHERE id = ?', (post_id,)).fetchone()
conn.close()if post is None:
abort(404)
return post
```Author: Joseph Nchimunya
Reference: [Digital Occean]()