Skip to content

Flask web app with Redis, Sklearn, APScheduler and others...

Notifications You must be signed in to change notification settings

dani37x/E-lectro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-lectro

E-lectro is a web application built using the Flask framework, with the main purpose of serving as an online shop. However, unlike traditional e-commerce websites, E-lectro focuses on non-visual aspects, such as security and unique solutions for specific problems.

One such solution is the Random Forest Classifier, which is used to classify users and recommend suitable products for them. This algorithm takes into account various factors such as past purchases, search history, and other user data to make personalized product recommendations.

Another feature of E-lectro is the use of Redis queue, which is used as an asynchronous task queue. This allows for faster processing of user requests and helps to improve the overall performance of the application. The project is a full backend solution, with a strong emphasis on security. It includes ready-made solutions like entries limiter and SQLAlchemy ORM, but also incorporates custom functions to solve specific problems.

Overall, E-lectro is a well-designed and fully-functional web application that demonstrates the power and flexibility of the Flask framework.


Roadmap

  • Own Admin management panel with basic operations on a row like
    • edit row
    • delete row
    • add a new row
    • search rows that contain query
    • sort system descending and ascending by database tables and their column properties
  • Protections wrappers:
    • wrapper for admin views, check whether a user is an admin
    • wrapper for common users, check their ip and account details
    • wrapper that co-works with my captcha system against bots
  • Group actions in the admin panel (many rows):
    • accounts users' activation
    • accounts users' deactivation
    • delete rows
    • delete inactive accounts
    • send test e-mails
    • block accounts
    • backups
    • restore databases
    • newsletter for registered users
    • set timed price hikes for products
    • set timed discounts for products
    • set the previous price for every product
    • set the lowest price for products from last month
    • set the highest price for products from last month
    • set the random price for products from last month
  • Redis and Redis queue
    • Redis queue and workers
    • old and new functions with co-work with async queue usage
    • time to cancel task from queue
    • delete cancelled task from rq history
  • Forms
    • Register form
    • Login form
    • Key form
    • New Password form
    • Remind Password form
    • Captcha Chars Counter form
  • Flask Login
    • Login
    • Authantacion
    • Register
    • Logout
  • Effective own validators
    • correct password with website standards
    • Exists user
    • Exists e-mail
    • not null validator for HTML form.
  • Background functions
    • automatic function which takes off a block from users' accounts after timed block.
    • clean the json files when data is expired
    • end operations with products after specific time
  • Error handlers
  • entries limiter
  • Event system, which gathers errors, actions to EVENTS.json which will be performed by users
  • Searching input for users which looking for products
  • Trending rank. Rank searches from users. Function gathers users queries and creates rank with them, then they are going to appeal on searching input area. Disallowed words do not contribute to the total
  • E-mails:
    • no-reply mail
    • reset password mail
    • register code mail
    • newsletter mail with the latest products
  • user account activation session:
    • mail with the key
    • sets active action
  • reset password sessions
    • limited duration to 15 minutes
    • auto-delete sessions after time
    • hash sessions
    • unique key and session generator
  • register session
    • e-mail with key for confirmation
    • account creates after the correct key
    • after 15 minutes session with registration is deleted and an account doesn't create
  • shop views
    • list of categories
    • dynamic list of products in category
    • dynamic single page for every product
    • sort system descending and ascending by product properties such as name, company, category, price
  • password change by a user on account
  • cookies with category of product with price from the searched product by the user
  • APScheduler
    • deletes expired data from json files every specific time
  • Newsletter
    • an e-mail for registered users with five of the latest products with links
    • register for the newsletter
    • unregister for the newsletter
  • ML algorithm - RandomForestClassifier
    • Machine Learning algorithm which adjust the best products for the shop's customers in every category of products
    • upgrade ML algorithm with many indicators
  • shop API
  • flask bcrypt
  • User personal data
    • editable
    • when the user wants to change 'the username' the app checks whether the new name is free
    • when the user wants to change the e-mail app sends an e-mail message with a code. After 15 minutes code will expire Without code, change is not possible
  • Own captcha system. Every user has only three chances before logout
    • random quizzes with random letters and sizes
    • the captcha wrapper for views.
    • registration how many times the user did not pass the captcha. Consequences with it(block of account)
    • only three tries for every user and only three times the user can't pass the captcha test by seven days
    • after a correct answer earlier wrong answers are deleted from the register
  • Price system
    • the recording system in PRICES.json tracks every action taken within the price system.
    • timed promotions for products
    • timed price hike for products
    • a super user can easily change the previous price of a product
    • the lowest price function informs the user about the lowest price observed in the last 30 days
    • If a product is on promotion, the highest price function informs the user about the highest price recorded within the last 30 days.
    • users can see how much money they will save on each product during the promotion, thanks to the discount
  • User panel
    • a user can change his nickname, e-mail, and the personal data
    • history of boughted products by users
  • classes of database with methods
  • better Readme section of installation which depict the correct process with Redis and Redis queue
  • option of payment for products
  • descriptions of funcs
  • more descriptions of files
  • tests of funcs
  • shop cart
  • multi-device login (max 3)
  • account lvl and points system with discounts.
  • payments for products
  • own hash password algorithm
  • own authentication system

Built With

  • FLASK
  • SKLEARN
  • SQLALCHEMY
  • REDIS
  • REDIS QUEUE
  • APSCHEDULER
  • LIMITER
  • FLASK-MAIL
  • FLASK-LOGIN
  • FLASK BCRYPT

Installation

  1. Clone the repository
    git clone https://github.com/dani37x/E-lectro.git
  2. Install python packages from requirements.txt in env
    pip install -r requirements.txt
  3. Get a free Mail API Key at https://mailtrap.io/
  4. Enter your API keys in variables in secret file
    os.environ['MAIL_USERNAME'] = '';
    os.environ['MAIL_PASSWORD'] = '';
  5. If you are Linux user go to step 11.
  6. Open Powershell as Administrator
  7. Run command
wsl --install
  1. After correct installation open WSL on Windows
  2. Activate virtual environment
  3. Install Python and Python's packages from requirements.txt in environment.
  4. Run redis-server with command
sudo service redis-server start
  1. Run Redis worker with command
rq worker

Contact

📫  dksluzbowe9@gmail.com

back to top