Foodgram Project React is a web platform where users can share their recipes, add other users' recipes to their favorites, and create a shopping list based on selected recipes.
- Features
- Technologies
- Installation
- Usage
- Configuration
- Documentation
- Data Import
- Contributing
- Credits
- License
- Recipe management: Users can create, view, edit and delete their own recipes.
- Recipe view: Recipes from all users are available for view.
- Favorites: Users can add recipes to their favorites list.
- Shopping List: Users can create a shopping list based on selected recipes.
- Python 3.9
- Django 3.2
- React 17
- PostgreSQL 13
- Docker 20
- Nginx 1.19
- Docker
- Docker-compose
- Clone this repository:
git clone https://github.com/4erdenko/foodgram-project-react.git
- Navigate to the project directory:
cd foodgram-project-react
-
Create a .env file in the root directory and fill it with your environment variables. A template .env file can be found in the repository.
-
Run docker-compose to build and start the containers:
cd
docker compose up -d
- The application will be accessible at
http://localhost
(or whatever your Docker host address is).
To start using Foodgram Project React, create an account or log in using an existing one. You can then start creating, editing and deleting your recipes, as well as add other users' recipes to your favorites or to your shopping list.
The project uses environment variables for configuration. These variables are set in a file named .env
which you'll need to create in the project root.
An example .env
file, named .env.EXAMPLE
, is included in the repository. This file lists all the environment variables used in the project with dummy values. Here's what the file contains:
POSTGRES_DB=kittygram
POSTGRES_USER=kittygram_user
POSTGRES_PASSWORD=kittygram_password
DB_HOST=db
DB_PORT=5432
SECRET_KEY='key'
DEBUG=False
ALLOWED_HOSTS=yourwebsite.com,111.222.333.444,127.0.0.1,localhost
CSRF=https://yourwebsite.com,https://111.222.333.444,127,http://127.0.0.1,http://localhost
EXTERNAL_PORT=your_port
To configure your application, make a new file named .env
and copy the contents of .env.EXAMPLE
into it. Then replace the dummy values with your actual data.
Here's what each of the environment variables is used for:
-
POSTGRES_DB
: The name of your PostgreSQL database. -
POSTGRES_USER
: The username of your PostgreSQL user. -
POSTGRES_PASSWORD
: The password for your PostgreSQL user. -
DB_HOST
: The hostname where your PostgreSQL database is hosted. -
DB_PORT
: The port number on which your PostgreSQL service is running. -
SECRET_KEY
: A secret key for Django. -
DEBUG
: A boolean flag that turns on/off debug mode in Django. -
ALLOWED_HOSTS
: A comma-separated list of strings representing the host/domain names that this Django site can serve. -
CSRF
: The list of trusted origins for CSRF. If not provided, Django will useALLOWED_HOSTS
. -
EXTERNAL_PORT
: Your custom port.
Note: Remember to set DEBUG
as False
when you're running in a production environment. Also, make sure to use a strong, unpredictable secret key.
The project includes documentation for the API endpoints. The documentation is automatically generated and can be accessed via the web interface.
Start project and open http://localhost/api/docs
address.
You should now be able to see the documentation for the project's API.
To import ingredient data into your application, navigate to the root directory of your project and run the following command:
python manage.py import_ingredients path/to/ingredients.csv
Or make sure that the ingredients.csv file is in the same directory.
Contributions are welcome. Please open an issue to discuss the proposed changes, or open a pull request with changes.
- Author: Valentin Kharenko
- Code Reviewer: Artem Nechai
Foodgram Project React is licensed under the MIT License.