This project is a Django-based web application that provides users with nutrition information based on their queries and displays blog posts fetched from an external API. The application includes user authentication, a contact form, and basic CRUD functionality
- Home Page: Users can enter a query to get nutrition information using the API Ninjas Nutrition API.
- Blog Page: Displays blog posts fetched from the JSONPlaceholder API.
- Contact Page: Users can submit their contact information and messages.
- User Registration: Users can create an account.
- User Login/Logout: Users can log in and log out.
- Python 3.x
- Django 3.x or later
- Requests library
-
Clone the repository:
git clone https://github.com/Abhi19990628/-Food-Calorie-Counter-using-Django-Python-and-an-external-API.-
-
Create and activate a virtual environment:
pip install virtualenv virtualenv name your env (my_env) cd\my_env\scripts\ ./actiavte
-
Install the required packages:
pip install -r requirements.txt
-
Run migrations:
python manage.py migrate
-
Create a superuser:
python manage.py createsuperuser
-
Run the development server:
python manage.py runserver
-
Open your browser and go to
http://127.0.0.1:8000
.
- API Keys: Update the
home
view to use your own API key for the API Ninjas Nutrition API.
health-app/ ├── health_guide/ │ ├── init.py │ ├── admin.py │ ├── apps.py │ ├── models.py │ ├── views.py │ ├── urls.py │ └── templates/ │ ├── home.html │ ├── blog.html │ ├── contact.html │ └── main/ | ├── register.html │ └── login.html ├── health_app/ │ ├── init.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── manage.py ├── db.sqlite3 ├── requirements.txt └── .gitignore
Handles the nutrition query and displays the results.
Fetches and displays blog posts from the JSONPlaceholder API.
Handles contact form submissions and stores the data in the database.
Allows users to register a new account.
Allows users to log in.
Logs out the user.
- home.html: Form to submit a nutrition query and display results.
- blog.html: Displays a list of blog posts.
- contact.html: Form to submit contact information.
- main/register.html: Registration form.
- main/login.html: Login form.
Stores contact form submissions.
Standard Django form for user registration.
Standard Django form for user authentication.
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please fork the repository and submit a pull request.
For any inquiries or questions, please contact [abhiv5976@gmail.com.com].