{"id":15952247,"url":"https://github.com/mokira3d48/kobra","last_synced_at":"2026-01-11T02:03:56.456Z","repository":{"id":169563553,"uuid":"591504876","full_name":"mokira3d48/kobra","owner":"mokira3d48","description":"A custom server program based on the Django framework designed  to allow a programmer to directly move to the implementation of  an application's features without having to torture himself with other time-consuming  configuration or installation.","archived":false,"fork":false,"pushed_at":"2025-11-14T03:00:55.000Z","size":415,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-14T03:25:04.682Z","etag":null,"topics":["django","django-rest-framework","openapi","postgresql","python","python3","server","swagger"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mokira3d48.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-01-20T23:21:52.000Z","updated_at":"2025-07-27T05:32:58.000Z","dependencies_parsed_at":"2024-07-13T04:25:42.316Z","dependency_job_id":"41e32f1a-9342-4de9-a32b-55e11910f17b","html_url":"https://github.com/mokira3d48/kobra","commit_stats":null,"previous_names":["mokira3d48/kobra"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mokira3d48/kobra","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mokira3d48%2Fkobra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mokira3d48%2Fkobra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mokira3d48%2Fkobra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mokira3d48%2Fkobra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mokira3d48","download_url":"https://codeload.github.com/mokira3d48/kobra/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mokira3d48%2Fkobra/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28269940,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T01:49:32.096Z","status":"online","status_checked_at":"2026-01-11T02:00:07.090Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","django-rest-framework","openapi","postgresql","python","python3","server","swagger"],"created_at":"2024-10-07T13:07:38.645Z","updated_at":"2026-01-11T02:03:56.431Z","avatar_url":"https://github.com/mokira3d48.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# KOBRA\n\n![](https://img.shields.io/badge/Python-3.10.8-blue)\n![](https://img.shields.io/badge/Django-5.0-%2344B78B)\n![](https://img.shields.io/badge/REST%20Framework-3.14.0-%23A30000)\n![](https://img.shields.io/badge/Swagger-OpenAPI%202.0-%23aaaa00)\n![](https://img.shields.io/badge/LICENSE-MIT-%2300557f)\n![](https://img.shields.io/badge/lastest-2025--06--25-success)\n![](https://img.shields.io/badge/contact-dr.mokira%40gmail.com-blueviolet)\n\n\u003c/div\u003e\n\nA custom server program based on the **Django framework** designed \nto allow a programmer to directly move to the implementation of \nan application's features without having to torture himself with other\ntime-consuming configuration or installation.\n\nYou can clone this repository everywhere you want in your machine,\nwith the following command lines:\n\n```sh\n# ~$\ngit clone https://github.com/mokira3d48/cobra.git myapp \u0026\u0026 cd myapp\n```\n\nIn this cloned directory, you will see the following structure:\n\n```\n.\n├── LICENSE\n├── README.md\n├── requirements.txt\n└── server\n    ├── core\n    │   ├── asgi.py\n    │   ├── __init__.py\n    │   ├── settings.py\n    │   ├── urls.py\n    │   └── wsgi.py\n    └── manage.py\n\n2 directories, 9 files\n```\n\nThis is the list of the installed features:\n1. **Django REST Framework**: it's a powerful and flexible toolkit\nfor building Web APIs.\n2. **drf-yasg**: for the generation of a documentation of the API in real\n**Swagger/OpenAPI 2.0 specifications** from a **Django Rest Framework** API.\n3. **Django CORS Headers**: it's a security mechanism that **allows one\ndomain to access** resources hosted on **another domain**.\n\n\n\u003cdetails id=\"table-content\" open\u003e\n    \u003csummary\u003eTable of Content\u003c/summary\u003e\n    \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"#1-dev-installation\"\u003e1. Dev installation\u003c/a\u003e\n            \u003cul\u003e\n                \u003cli\u003e\u003ca href=\"#install-python3\"\u003e1.1 Install python3\u003c/a\u003e\u003c/li\u003e\n                \u003cli\u003e\u003ca href=\"#install-venv\"\u003e1.2 Install venv\u003c/a\u003e\u003c/li\u003e\n                \u003cli\u003e\u003ca href=\"#install-postgresql\"\u003e1.3 Install PostgreSQL\u003c/a\u003e\u003c/li\u003e\n                \u003cli\u003e\u003ca href=\"#configuration\"\u003e1.4 Configuration\u003c/a\u003e\n                    \u003cul\u003e\n                        \u003cli\u003e\u003ca href=\"#setting-virtual-environment\"\u003e1.4.1 Setting virtual environment\u003c/a\u003e\u003c/li\u003e\n                        \u003cli\u003e\u003ca href=\"#creating-and-setting-of-postgresql-database\"\u003e1.4.2 Creating and setting of PostgreSQL database\u003c/a\u003e\n                            \u003cul\u003e\n                                \u003cli\u003e\u003ca href=\"#a-env-config\"\u003ea. .env settings\u003c/a\u003e\u003c/li\u003e\n                                \u003cli\u003e\u003ca href=\"#b-launching-the-server\"\u003eb. Server settings\u003c/a\u003e\u003c/li\u003e\n                            \u003c/ul\u003e\n                        \u003c/li\u003e\n                    \u003c/ul\u003e\n                \u003c/li\u003e\n            \u003c/ul\u003e\n        \u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"#launching-the-server\"\u003e2. Launching the dev server\u003c/a\u003e\u003c/li\u003e\n    \u003c/ul\u003e\n\u003c/details\u003e\n\n\n## 1. Dev Installation\nWe must install three (03) programs:\n1. `Python3` runtime;\n2. Python virtual environment `venv`;\n3. Database manager `PostgreSQL`;\n4. Getting of project repository.\n\n\n### Basic dependencies\nFor Linux system users, you can install the following dependencies:\n\n```shell\nsudo apt install cmake\n```\n\n### 1.1. Install python3\n\n```sh\n# ~$\nsudo apt install python3 python3-pip\n```\n\nYou have to make sure of the version of python that is installed.\nThe version of python used is *Python 3.10.9*.\n\n### 1.2. Install venv\nYou can install a python virtualenv program in two different ways.\n\n```sh\n# ~$\nsudo apt install python3-venv\n```\n\nOR\n\n```sh\n# ~$\nsudo pip3 install virtualenv\n```\n\n### 1.3. Install PostgreSQL\n\n```sh\n# ~$\nsudo apt install postgresql postgresql-contrib\n```\n\nFor using a *spacial database*, we can install the following extension:\n\n```sh\n# ~$\n# PostGIS is an extension of PostgreSQL\n# that allows to process the spacial data like the Polygons,\n# the Points, ...\nsudo apt install postgis\n```\n\n\n### 1.4 Configuration\n1. Setting virtual environment;\n2. Creating and setting of PostgreSQL database;\n3. Dependencies installation.\n\n#### 1.4.1 Setting virtual environment\n1. In your project root, if you have not already done so,\nrun one of the following commands to create a virtual environment.\n\n```sh\n# ~$\npython3 -m venv env\n```\n\nOR\n\n```sh\n# ~$\nvirtualenv env -p python3\n```\n\n2. Launch environment\n\n```sh\n# ~$\nsource env/bin/activate\n```\n\n3. You must execute the following command to install the basic dependences:\n\n```sh\n# ~$\nmake install\n```\n\n#### 1.4.2 Creating and setting of PostgreSQL database\nThe following `SQL` command lines allow to create a `PostgreSQL`\ndatabase for your application:\n\n```sh\n# ~$\n# To connect to PostgreSQL with ROOT user:\nsudo su - postgres\n```\n\n```sh\n# ~$\n# To connect to default database (postgres)\npsql\n```\n\nGiven your database name is `cbrdb` and the username is `cobra`.\n\n```sql\nCREATE DATABASE cbrdb;\nCREATE USER cobra WITH ENCRYPTED PASSWORD 'your-secret-password-here';\nALTER ROLE cobra SET client_encoding TO 'utf8';\nALTER ROLE cobra SET default_transaction_isolation TO 'read committed';\nALTER ROLE cobra SET timezone TO 'Europe/Paris';\nGRANT ALL PRIVILEGES ON DATABASE cbrdb TO cobra;\n\n-- configuration for testing database for Django\nALTER USER cobra CREATEDB;\n-- ALTER ROLE cobra SUPERUSER;\n\n-- connect to cbrdb.\n\\c cbrdb;\n\n```\n\nGive the access of the `public` schema to the user account of the application.\n\n```sql\nGRANT ALL ON SCHEMA public TO cobra;\n```\n\nFor the spacial database, you must create the following extensions on it.\n\n```sql\n-- ...\n\n-- Only you are using a spatial database\nCREATE EXTENSION postgis;\n```\n\nFinally, disconnect from PostgreSQL by pressing `CTRL + D` twice.\n\n\n##### a. .env settings\n1. You have to create a `.env` file in the root of the server\nfrom the `server/.env_example`:\n\n```sh\ncp server/.env_example server/.env\n```\n\n2. Insert the following information into `.env` file:\n\n| FIELDS   | VALUES                    | DESCRIPTION            |\n| ------   | --------------------------|------------------------|\n| DB_NAME  | cbrdb                     | Database name.         |\n| USERNAME | cobra                     | User name of database. |\n| PASSWORD | your-secret-password-here | User password.         |\n| HOST     | 127.0.0.1                 | The access hostname to connect to the database. |\n| PORT     | 5432                      | The access PORT to connect to the database. |\n\nHere are the contents of the file `.env`:\n\n```\nDB_NAME=cbrdb\nUSERNAME=cobra\nPASSWORD=your-secret-password-here\nHOST=127.0.0.1\nPORT=5432\n\n```\n\n\u003e If port `5432` does not work, then try port `5433`.\n\n3. Execute the following command line, to apply the configs made in the\n`server/.env` file.\n\n```sh\nsource ./server/.env\n```\n\n\n##### b. Server settings\n\u003c!--\n- Create two directories named `static` and `media`,\nusing the following commands:\n\n```sh\nmkdir server/static;\\\nmkdir server/media\n```\n--\u003e\n\n- Execute the following command lines to make migrations of models into\ndatabase. It's assumed that you are currently in project directory\nroot `cobra`.\n\n```sh\n# ~$\n./server/manage.py makemigrations;\\\n./server/manage.py migrate\n```\n\nor\n\n```shell\n# ~$\nmake migrations\n```\n\nYou will get the following result, if all works successfully :\n\n![](./images/migrations.png)\n\n- Then, create a superuser that will be used to connect to admin space.\n\n```sh\n# ~$\n./server/manage.py createsuperuser\n```\n\nOr \n\n```shell\n# ~$\nmake csudo\n```\n\n### Lauching the server\nTo start server, you must execute the following command line:\n\n```sh\n# ~$\n./server/manage.py runserver\n```\n\nThe result is:\n\n![](./images/runserver.png)\n\nWe cant go it at this local host link [](http://127.0.0.1:8000/) or [](http://localhost:8000). \u003cbr/\u003e\nYou can change the IP address and the port of the server with the following command line:\n\n```sh\n# ~$\n# With this command, we cant make the server listens\n# on the IP address of your local network on the port 8080.\n./server/manage.py runserver 0.0.0.0:8080\n```\n\nOr you can execute the following command contained in `Makefile`.\n\n```sh\n# ~$\nmake run\n```\n\nYou will see:\n\n![](./images/runserver2.png)\n\nAll work with successfully ! \u003cbr/\u003e\nTo access it in this cas, you must execute the following command line,\nin first:\n\n```sh\n# ~$\n# IF YOU ARE USING LINUX\n# show your IP address of your machine, if it's connected\n# to your local network for example.\nifconfig\n```\n\n\u003e For the people using **Windows**, use `ipconfig` insted of the command line\n\u003e above.\n\nWe cant go it at this local host **http://yourip:8080**.\n\n![](./images/swagger.png)\n\n\n### Nettoyage de la base de données PostgreSQL\nCette section est facultative. Mais, il peut arriver un jour où tu aurras besoin de néttoyer toutes\nles tables de la base de données. Alors, c'est simple. Pour y parvcenir, tu peux simplement supprimer\ntous les schémas que tu as créé. Dans cet exemple, il n'y a qu'un seul schéma que tu vas néttoyer : `public`.\n\u003cbr/\u003e\nConnecte-toi en mode `root` avec les deux commandes suivantes :\n```sh\nsudo su - postgres\n```\n```sh\npsql\n```\n\nEnsuite connecte-toi en tent que `user_name` à `db_name` :\n```sh\n\\c user_name db_name\n```\nMaintenant, tu peux supprimer le schéma :\n```sql\nDROP SCHEMA public CASCADE;\n```\nEnsuite tu le recrées avec la commande SQL suivante :\n```sql\nCREATE SCHEMA public;\n```\nEt enfin, il ne faut pas oublier de redonner les droits d'accès du schéma à l'utilisateur utilisé par\nton application pour se connecter.\n```sql\nGRANT ALL ON SCHEMA public TO user_name;\nGRANT ALL ON SCHEMA public TO public;\n```\n\n\n## Usage\nFor the different usages, you can consult the different documentation\navailable [here](./docs/README.md).\n\n1. PostGIS\n2. Cross Origin Resource Sharing\n3. Usage example of Django REST Framework\n4. JWT authentication with Django REST Framework\n5. API documentation programming\n6. Using cache with apiview and viewsets\n\n\u003cbr\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmokira3d48%2Fkobra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmokira3d48%2Fkobra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmokira3d48%2Fkobra/lists"}