Neem-Sheth / SAS-Fat-To-Slim---Techmill

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Food Tracker

This is a food-tracking application built using Django 4, HTML 5, CSS 3 and Bootstrap 5 with a Bootswatch theme. The app uses a PostgreSQL database to store data. Charts were built using Chart.js 2. And the customizable admin panel using Jazzmin.

Screenshot 2024-03-24 114038

Screenshot 2024-03-24 114055

Screenshot 2024-03-24 114119

Screenshot 2024-03-24 114211

Screenshot 2024-03-24 114229

Table of Contents

Prerequisites

Install the following prerequisites:

  1. Python 3.8-3.11
    This project uses Django v4.2.4. For Django to work, you must install a correct version of Python on your machine. More information here.
  2. PostgreSQL
  3. Visual Studio Code

Installation

1. Create a virtual environment

From the root directory, run:

python -m venv venv

2. Activate the virtual environment

From the root directory, run:

On Windows:

venv\scripts\activate

3. Install required dependencies

From the root directory, run:

pip install -r requirements.txt

4. Set up a PostgreSQL database

With PostgreSQL up and running, in a new Terminal window, run:

dropdb --if-exists food

Start psql, which is a terminal-based front-end to PostgreSQL, by running the command:

psql postgres

Create a new PostgreSQL database:

CREATE DATABASE food;

Create a new database admin user:

CREATE USER yourusername WITH SUPERUSER PASSWORD 'yourpassword';

To quit psql, run:

\q

5. Set up environment variables

From the root directory,:

Create the .env file manually by navigating in Visual Studio Code to the Explorer and selecting the option New File.

Next, declare environment variables in the .env file. Make sure you don't use quotation marks around the strings. Add appropriate Twilio Credentials for Twilio Whatsapp API.

SECRET_KEY=yoursecretkey
DEBUG=True
DATABASE_NAME=food
DATABASE_USER=
DATABASE_PASS=
DATABASE_HOST=localhost

TWILIO_ACCOUNT_SID=
TWILIO_AUTH_TOKEN=

6. Run migrations

From the root directory, run:

python manage.py makemigrations
python manage.py migrate

7. Create an admin user to access the Django Admin interface

From the root directory, run:

python manage.py createsuperuser

When prompted, enter a username, email, and password.

Run the application

From the root directory, run:

python manage.py runserver

View the application

Go to http://127.0.0.1:8000/ to view the application.

Add data to the application

Add data through Django Admin.

Go to http://127.0.0.1:8000/admin to access the Django Admin interface and sign in using the admin credentials.

About


Languages

Language:HTML 44.8%Language:SCSS 28.6%Language:JavaScript 12.5%Language:CSS 10.5%Language:Python 3.5%