Skip to content

Commit

Permalink
Docs (#56)
Browse files Browse the repository at this point in the history
* delete unused view

* Update logout view

* Added HTML templates for Swagger UI and ReDoc

* Update README

* update README(2)

* update README(3)

* update README(added bages)
  • Loading branch information
dev-lymar committed May 21, 2024
1 parent f386c7c commit 95f5143
Show file tree
Hide file tree
Showing 8 changed files with 1,928 additions and 36 deletions.
60 changes: 38 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
[![Python](https://img.shields.io/badge/-Python-3776AB?style=flat&logo=Python&logoColor=yellow)](https://www.python.org/)
[![Django REST Framework](https://img.shields.io/badge/-Django%20REST%20Framework-092E20?style=flat&logo=django&logoColor=white)](https://www.django-rest-framework.org/)
[![PostgreSQL](https://img.shields.io/badge/-PostgreSQL-336791?style=flat&logo=PostgreSQL&logoColor=white)](https://www.postgresql.org/)
[![Docker](https://img.shields.io/badge/-Docker-2496ED?style=flat&logo=Docker&logoColor=white)](https://www.docker.com/)
[![Nginx](https://img.shields.io/badge/-Nginx-269539?style=flat&logo=Nginx&logoColor=white)](https://www.nginx.com/)
[![Psycopg2-binary](https://img.shields.io/badge/-Psycopg2--binary-4169E1?style=flat)](https://pypi.org/project/psycopg2-binary/)
[![Gunicorn](https://img.shields.io/badge/-Gunicorn-FFD700?style=flat&logo=Gunicorn&logoColor=white)](https://gunicorn.org/)
[![pytest](https://img.shields.io/badge/-pytest-0A9EDC?style=flat&logo=pytest&logoColor=white)](https://docs.pytest.org/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![SimpleJWT](https://img.shields.io/badge/SimpleJWT-orange?style=flat&logo=jwt&logoColor=white)](https://github.com/jazzband/djangorestframework-simplejwt)

# Melnichanka

## Table of Contents
Expand All @@ -12,20 +23,19 @@

## How to run the project

1. Install `Docker` and `Docker Compose`
To get started with Melnichanka, you will need to have Docker and Docker Compose installed on your system. You can follow the instructions for your operating system here and here.
1. Install [`Docker`](https://www.docker.com/) and [`Docker Compose`](https://docs.docker.com/compose/)
To get started with Melnichanka, you will need to have [Docker](https://www.docker.com/) and [Docker Compose](https://docs.docker.com/compose/) installed on your system. You can follow the instructions for your operating system here and here.

Once you have Docker and Docker Compose installed, follow these steps to start the project:
Once you have [Docker](https://www.docker.com/) and [Docker Compose](https://docs.docker.com/compose/) installed, follow these steps to start the project:

- Clone the repository:

```
```sh
git clone https://github.com/KroshkaByte/Melnichanka.git
cd Melnichanka
```

- Start the project from root directory:

```
```sh
docker-compose up -d --build
```
- Open your web browser and navigate to http://localhost:80 to access the application.
Expand Down Expand Up @@ -63,40 +73,40 @@ Please follow the steps below to run the script:

- Run the following command:

```
```sh
python3 manage.py runscript faker_script
```
Make sure `django-extensions` is installed and added to `INSTALLED_APPS` in your Django settings.

This command will execute the `faker_script` script, which will then populate the database with the generated data.

Please note that the data generated by the Faker library is random and does not represent any real information.

## Additional Information

- Ensure that your `virtual environment` is activated before running the commands, if you're using one.
- The `runscript` command is a part of `django-extensions`. If it's not working, make sure you have `django-extensions` installed and added to your `INSTALLED_APPS` in your Django settings.
Ensure that your `virtual environment` is activated before running the commands, if you're using one.

## Documentation

API documentation is available through Swagger UI and ReDoc.

- [Swagger UI](http://localhost:8000/api/schema/swagger-ui/)
- [ReDoc](http://localhost:8000/api/schema/redoc/)
- [Swagger UI](https://dev-lymar.github.io/Melnichanka/melnichanka_swager_ui)
- [ReDoc](https://dev-lymar.github.io/Melnichanka/melnichanka_redoc)

For local access, navigate to [`Swagger UI`](http://localhost:8000/api/schema/swagger-ui/) and [`ReDoc`](http://localhost:8000/api/schema/redoc/) in your browser after starting the project.

## Testing

To run the tests, navigate to the root directory of the project (where the manage.py file is located) and run the following command:

```
```sh
pytest .
```
or
```
```sh
python3 -m pytest .
```

- To run tests for a specific application (such as goods, logistics, users, etc.) use the following command:
```
```sh
pytest goods
pytest logistics
pytest users
Expand All @@ -105,12 +115,18 @@ pytest makedoc
```
## Contributing

We welcome contributions to Melnichanka. To contribute, follow these steps:
We welcome contributions to Melnichanka. To contribute:

1. Fork the repository.
2. Create a new branch for your changes.
3. Make your changes and commit them to your branch.
4. Update your branch from the main repository:
```sh
git fetch upstream
git merge upstream/main
```

- Fork the repository.
- Create a new branch for your changes.
- Make your changes and commit them to your branch.
- Submit a pull request.
5. Submit a pull request.

We will review your pull request and provide feedback as needed.

Expand Down
19 changes: 19 additions & 0 deletions docs/melnichanka_redoc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<title>ReDoc</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
<style>
body {
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<redoc spec-url='./schema.json'></redoc>
<script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"> </script>
</body>
</html>
34 changes: 34 additions & 0 deletions docs/melnichanka_swager_ui.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<title>Swagger UI</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/swagger-ui-dist/swagger-ui.css">
<style>
body {
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="swagger-ui"></div>
<script src="https://cdn.jsdelivr.net/npm/swagger-ui-dist/swagger-ui-bundle.js"> </script>
<script src="https://cdn.jsdelivr.net/npm/swagger-ui-dist/swagger-ui-standalone-preset.js"> </script>
<script>
window.onload = function() {
const ui = SwaggerUIBundle({
url: './schema.json',
dom_id: '#swagger-ui',
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
layout: "StandaloneLayout"
})
window.ui = ui
}
</script>
</body>
</html>
Loading

0 comments on commit 95f5143

Please sign in to comment.