This is a project for training python, Flask, Git and github, Codeium, chatGPT. This project was an example of a Python course on the internet Which I have customized and modified with my own needs and experiences. In this example, I have tried to test some technologies and methods and turn it into a training example with the comments I have embedded in the program.
This is an application that verifies the authenticity of serial numbers of goods via SMS and web. This document is prepared to show the complete project plan, architecture diagram, database design, folder structure, technology stack, deployment guidelines, and feature roadmap for the serial number verification system.
Python Flask blueprint flask_login use SQLAlchemy to connect sqlite mainmenu and authentication (my github https://github.com/hesamzia/Mainmenu_And_Authentication.git) Html and bootstrap save picture in database for profile editable table for users (make a javascript for bootstrap html)
Serial number inquiry is done through two ways: web (main application) and SMS. To access the SMS section and reply to SMS, you must subscribe through one of the SMS providers and this requires payment. Therefore, to reduce costs and allow proper testing during programming, a cached application has been prepared to simulate the operation of sending and receiving SMS, in which text messages are sent and received from port 5001 of the local host to port 5000 of the same local host through a web page. Both of these applications are present in this project.
Backend: Flask 3.1+
Database: sqlite3
ORM: SQLAlchemy
Frontend: HTML5 + Bootstrap 5
requirments.txt
CREATE TABLE user ( id INTEGER PRIMARY KEY, email TEXT, password TEXT, name TEXT, phone text, Address text, job text, birthday date, gender varchar(1), language varchar(20), picture blob, permission_level varchar(1), confirmed varchar(1));
CREATE TABLE serials ( id INTEGER NOT NULL, ref VARCHAR(50), "desc" VARCHAR(100), start_serial VARCHAR(50), end_serial VARCHAR(50), date VARCHAR(50), PRIMARY KEY (id) );
CREATE TABLE invalids ( invalid_serial VARCHAR(50) NOT NULL, PRIMARY KEY (invalid_serial) );
CREATE TABLE process_serials( id integer PRIMARY KEY, sender varchar(20), message varchar(100), serial varchar(30), response varchar(1), platform varchar(1), process_date datetime);
CREATE TABLE smslogs ( id INTEGER PRIMARY KEY, task varchar(30), taskdate datetime);
github or ... SMS-VERIFICATION : Environment Setup: Install Python 3.10+ Create virtual environment: python -m venv venv Activate venv and install requirements: pip install -r requirements.txt Database Setup: Create sqlite3 database and update config.py Run Locally: flask --app SMS-Verification run --debug Access at: http://127.0.0.1:5000 SIMULATION OF SMS PROVIDER : Environment Setup: Install Python 3.10+ Run locally : run in spider or ... Access at: http://127.0.0.1:5001
- Signup and make your user
- Login with sasan.ziaee48@gmail pass 123 (It is admin user) and in users page confirm it.
- On check one serial of Dashboard you can check serial is in valid list or not...
- On Import Excel file of Dashboard you can upload and import new serials list to database.
- On Messages of last 30 days table of Dashboard you can see serials that have checked.
- On pie chart and up boxes of Dashboard you can see count of each type of result that have checked
- On the profile section you can change your personal information. (To change the photo, click on the photo and select a new photo)
- On the user page, the admin can confirm the new user and give it a role. (Only admin has access to this page)
- add DB path to config.py sample
- do more while normalizing, specially against SQLInjection. remove all non alpha numerical.
- some health check url
- there is problem with JJ1000000 and JJ100
- create requirements.txt (pip freeze)
- the insert will fail if there is a ' or " in excel file-->I am safe because using sqlalchemy in correct way
- another 10% problem :D
- refactor name str in normalize function
- change to use sqlalchemy in import database
- Change the database is accessed with using sqlalchemy, except in the login section
- in normalize, convert for example AB001 to AB000001 (max len ? say 15)
- Add upload Excel file before importing
- rate limit and stop the brute force
- add call back token on sender site (a key on route that just sender know)
- change html pages to a new admin bootstrap pages.
- Add import and others to new bootstrap pages.
- Arrange the page and menus according to future needs
- log messages (sms and main menu search) in the database
- Add report of number of messages, confirmed serials, failures and not found serials into the cards in top of page
- Online Monitoring of last serials checked (show logged messages)
- dismissible alerts
- Check on serial from main page
- Add 404 page
- Add last import date
- Add licenses and authors
- Fix SMS list and counts for last month
- Add pie chart
- Remove the extra files from bootstrap and ...
- Add profie page
- Add picture to profile and db
- Confirming the signed-up user by the admin
- User Permissions (one Admin user and others...)
- Admin can see Users list
- Logged user don't need signup,forget password and login
- Fix blank data error in profile
- Add user page and edit role and confirm signed up user (except admin)
- Make the program code more modular.
- Add error handler - It will become more perfect with time.
- Readme and user manual
- Fix signup and forgot_password bugs
- Fix pie chart bug in index.html file script
- Remove one by one row's commit in import
- modular flash in HTMLs