Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cha-nox/url_shortener
URL shortener web app that I created to learn Flask on my own.
https://github.com/cha-nox/url_shortener
flask flask-bcrypt flask-blueprint flask-limiter flask-sqlalchemy html-css jinja2 postgresql pyjwt python3 scss wtforms
Last synced: 2 days ago
JSON representation
URL shortener web app that I created to learn Flask on my own.
- Host: GitHub
- URL: https://github.com/cha-nox/url_shortener
- Owner: cha-nox
- Created: 2023-11-28T15:12:26.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-10-05T23:27:16.000Z (about 1 month ago)
- Last Synced: 2024-10-31T15:37:09.090Z (18 days ago)
- Topics: flask, flask-bcrypt, flask-blueprint, flask-limiter, flask-sqlalchemy, html-css, jinja2, postgresql, pyjwt, python3, scss, wtforms
- Language: Python
- Homepage:
- Size: 194 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Database initialisation
Create the database manually then use these lines in `flask shell` to create the database tables.
```python
>>> from app.extensions import db
>>> from app.models.user import User
>>> from app.models.link import Link
>>> db.create_all()
>>> exit()
```
If you don't know how to create manually the database, please refer to PostgreSQL and/or your host documentation.# Environnement initialisation
Rename the "example.env" file to ".env" then go in it to replace the environnement informations with your ones.If you don't want to set the secret key in the .env file, you can remove it from it since "config.py" set a random one if no one is set in the .env file. If so, "config.py" uses `os.urandom(INT).hex()` to generate the secret key. I used this way because the required library was already required elsewhere in the same script. But feel free to use something else if you want/need (e.g. : `uuid.uuid4().hex()` from "uuid", `token_urlsafe(INT)` or `token_hex(INT)` from "secrets", or even just remove the `.hex()` from the `os.urandom(INT).hex()`). Just replace the "INT" with any integer.
If you're looking for installing PostgreSQL and/or Python on your server or webhost, please refer to Python, PostgreSQL, and/or your webhost docs.