Photo by Jeremy Bishop on Unsplash
AstraMarket is web-application for selling and buying products.
- Registering as normal user can be done by clicking 'Sign Up' button. For registering as admin user you have to use flask commandline.
- Users can add products, edit products, and comment on them. User can also delete these.
- Users can also report unappropriate comments.
- Admins can hide these reported comments and also permanently ban users.
- Banned users can't log in anymore.
- Users can like each others profiles.
- In marketplace products can be searched for with search bar. Category, condition and sorting order of the products can also be specified.
- Python version 3.8.1 or higher
- PostgreSQL database
In the root folder of the application create .env
file.
In .env file set variable SQLALCHEMY_DATABASE_URI
as path to postgresql database, and secret key to SECRET_KEY
variable.
Also set variables UPLOAD_FOLDER=src/static
and FLASK_APP=src/app.py
Example:
SECRET_KEY=Strong_secret_key
SQLALCHEMY_DATABASE_URI=postgresql://database_name:password@localhost/database_user
DB_HOST=localhost
DB_NAME=database_name
DB_USER=database_user
DB_PASSWORD=password
UPLOAD_FOLDER=src/static
FLASK_APP=src/app.py
- Install requirements from requirement.txt file with pip.
pip3 install -r requirement.txt
- In root directory of application first activate venv.
Source venv/bin/activate
- Now run flask.
flask run
To initiate database just run schema.py file.
This application can be accessed in heroku:
https://marketplacetsoha.herokuapp.com/login
To try admin functionalities use following credentials:
Username=admin
Password=admin
I learned how to use css, html and bootstrap in depth. I also tried to learn flask methods and extensions as much as possible. I learned to implement flask in my own ways, but at the risk of there being some security issues. I am not sure if post_injection of database methods with context_processor is safe yet, and have to find out more about that. I found post_injection useful in fetching information data to jinga.
I think report functionalities are lacking. In the future I would like to offer users possibility of reporting products and other users. Also I thought that encapsulation of python functions wasn't good enough. I want to put more thought into how to arrange methods into classes, and when its wise to use classes? Is it always needed?