It is a flask web application where you can manage your 🏪 business like adding new products, managing new orders etc.
To use the application you need to create an account on the application & then login and now you can use the services provided by the application. Link - https://grocerymanager.pythonanywhere.com
If anyone is interested in running the code in local maching then follow the below mentioned steps:-
Clone the git repo locally in your machine
$ git clone https://github.com/Rahulbaran/grocery-manager.gitCreate a virtual environment in the project folder(root) in your machine (python3.9 is recommended)
> python -m venv virtual$ python3 -m venv virtualActivate the created virtual environment
If you are using command prompt
> virtual/scripts/activate.batIf you are using git bash terminal
$ . virtual/scripts/activate$ source virtual/bin/activateInstall all the python packages using requirements.txt file provided in the repo.
(virtual)$ pip install -r requirements.txtIf Some packages did not install then try to install them individually (In my case I had to install wheel separately).
Create a .env file in root directory (folder) and put the following inputs (in capital) in the file which will be used in app configuration.
| INPUT NAME |
|---|
| SECRET_KEY |
| RECAPTCHA_PRIVATE_KEY (You will have to register your application in Google Recaptcha website to get private & public keys) |
| RECAPTCHA_PUBLIC_KEY |
| GMAIL_USERNAME |
| GMAIL_PASSWORD (You will have to generate it using google account) |
| ADMIN_USERNAME (Use any username and password you wish for admin page) |
| ADMIN_PASSWORD |
| ACCOUNT_SID (To use the admin page you will have to go through 2FA & I am using Twilio for OTP) |
| AUTH_TOKEN |
| TWILIO_PHONE_NUMBER |
| PERSONAL_MOBILE_NUMBER (Provide any mobile number you wish to get the OTP for 2FA) |
Create a directory (folder) Databases in grocery folder of your root directory.
(virtual)$ cd grocery
(virtual)$ mkdir DatabasesSet the following configuration in your CLI (Command Line Interface)
(virtual)> set FLASK_APP=run && set FLASK_ENV=development(virtual)$ export FLASK_APP=run && export FLASK_ENV=developmentOpen Python Interpreter and create sqlite database as shown below
>>> from grocery import create_app, db
>>> with create_app().app_context():
db.create_all()A sqlite database file of name dev.db will be created in Databases folder.
If You are interested in using MYSQL as database then You will have to add configuration required for MYSQL in your .env file
MYSQL_DB_URI='mysql+pymysql://<username>:<password>@localhost/grocery'Now create the database using the same command , you have used for sqlite database.
Now Run your application
$ flask runCongrats, You did it🙂🎉
