{"id":26397269,"url":"https://github.com/timalexanderandersson/read-review-django-api","last_synced_at":"2025-10-12T09:38:23.238Z","repository":{"id":262973532,"uuid":"888942260","full_name":"Timalexanderandersson/Read-review-Django-API","owner":"Timalexanderandersson","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-31T09:24:54.000Z","size":759,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-17T12:17:12.066Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Timalexanderandersson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"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":"2024-11-15T09:54:20.000Z","updated_at":"2025-01-31T09:24:57.000Z","dependencies_parsed_at":"2024-11-15T11:18:56.203Z","dependency_job_id":"2b9047d3-329a-4742-871f-278b126c6b3c","html_url":"https://github.com/Timalexanderandersson/Read-review-Django-API","commit_stats":null,"previous_names":["timalexanderandersson/read-review-django-api"],"tags_count":0,"template":false,"template_full_name":"Code-Institute-Org/ci-full-template","purl":"pkg:github/Timalexanderandersson/Read-review-Django-API","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Timalexanderandersson%2FRead-review-Django-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Timalexanderandersson%2FRead-review-Django-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Timalexanderandersson%2FRead-review-Django-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Timalexanderandersson%2FRead-review-Django-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Timalexanderandersson","download_url":"https://codeload.github.com/Timalexanderandersson/Read-review-Django-API/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Timalexanderandersson%2FRead-review-Django-API/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010938,"owners_count":26084837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"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":[],"created_at":"2025-03-17T12:17:14.775Z","updated_at":"2025-10-12T09:38:23.223Z","avatar_url":"https://github.com/Timalexanderandersson.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Read \u0026 Review API\n\nThis is the Read \u0026 reviews API build with Django REST Framework. The read \u0026 review API contains CRUD functionality(Create, Read, Update, Delete). User must sign in to access all the features available on the platform such as Post and comment on reviews made. The read \u0026 review API is made for sharing content(Posts, Comments) and make interactions possible for users who enjoy reading books.\n\n## Validation\n\n- CI python Linter\n- tested in all serializers and views.\n\n![alt text](images/dawdawdawd.PNG)\n\n## Diagram for models\n\n\u003cdetails\u003e\n\u003csummary\u003eDiagram models comment \u003c/summary\u003e\n\u003cbr\u003e\n\u003cimg src=\"images/Comments-model.PNG\"\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eDiagram models post \u003c/summary\u003e\n\u003cbr\u003e\n\u003cimg src=\"images/models-post.PNG\"\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eDiagram models Contact \u003c/summary\u003e\n\u003cbr\u003e\n\u003cimg src=\"images/modelscontact.PNG\"\u003e\n\u003c/details\u003e\n\n- lucid.app to create the diagrams\n\n## Diagram for Database\n\n### Post and comment database table\n\n![database](images/forginekey.PNG)\n\nPost contains the id for the post, created_at is the timestamp for when it was done, title for post made , description for the post,image_post is the image of the review, user_id is the id of user.\n\nComments contains id for the comment, created_at is the timestamp for when it was done, comment for user to comment a text, post_id is the id of the post user is on, user_id is the id of user.\n\n### Sendmailapp database table\n\n![sendmail](images/mailapp.PNG)\n\nContaining Id, name on the contact user, email_user for email adress, show_alternativ is alternativs for what this contact is about.\n\ndescription about the contact, and created_at as a timestamp when it was made.\n\n# Planning\n\n### User stories om github\n\n- Here is all the user storys made for this project. from the django rest back-end to React front-end planning.\n\n[User story github](https://github.com/users/Timalexanderandersson/projects/11)\n\n# Agile methodology\n\nWas using Agile methodology while working on the project Read \u0026 Review. which worked good, following the user storys and checking them of one by one. making sure they was living up to acceptance criteria.\n\n# Testing in Django REST\n\n## Testing in Django REST\n\n### views\n\n| Status  | **Posting - Post is valid**                            |\n| :-----: | :----------------------------------------------------- |\n| \u0026check; | test for sending post (status code 201). created post. |\n\n| Status  | **Comments - Valid comment created**                           |\n| :-----: | :------------------------------------------------------------- |\n| \u0026check; | tested for creating comment (status code 201) comment created. |\n\n| Status  | **sign in - Valid Data**                                     |\n| :-----: | :----------------------------------------------------------- |\n| \u0026check; | When the user try to sign in (status code 200) user sign in. |\n\n## Deployment\n\n### Create project repository github\n\nLog in to **GitHub** then navigate to **Code institute template** for making the project. \n\n[Code institute template ](https://github.com/Code-Institute-Org/ci-full-template).\n\n![starttemplet](images/githubtemp.PNG)\n\nClick on the **\"Use this template\"** on rigth side of the page, and then press the **\"Create a new repository\"**\n\n![repository](\u003cimages/skapa ny.PNG\u003e)\n\nCreating a descriptive project name in the **\"Repository name\"** field. In the Public/Private section choose Public.\nThen click **\"Create Repository\"**.\n\n![allneeded](\u003cimages/allt desista.PNG\u003e)\n\n### Create heroku app\n\nLogin to the **heroku platform**.\n\nNavigate to the dropdown bar to the right of the website(New) on the homepage, choose to **\"Create new app\"**\n\n\u003cdetails\u003e\n\u003csummary\u003e \u003cstrong\u003eNew\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n\u003cimg src=\"images/skapanyappheroku.PNG\"\u003e\n\u003c/details\u003e\n\u003cdetails\u003e\n\u003csummary\u003e \u003cstrong\u003eCreate app\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n\u003cimg src=\"images/härskapar.PNG\"\u003e\n\u003c/details\u003e\n\n\n\n\nGive the app a project name, and choose the location you are in(Eu/US).\n\u003cdetails\u003e\n\u003csummary\u003e \u003cstrong\u003eUs/Eu\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n\u003cimg src=\"images/skapadennyyy.PNG\"\u003e\n\u003c/details\u003e\n\nThen press **\"Create app\"**\n\n### Creating cloudinary account for images\n\n  - **cloudinary** Create account on the https://cloudinary.com/users/register_free website.\n\n  - When access to website. go into **settings** in the left corner of the website on the bottom.\n\n  ![settings](images/cloudsettings.PNG)\n\n  - Press the section **API Keys** up in the left corner. and press the button for **Generate new API key**\n\n  ![newtrextr](images/apikeysettings.PNG)\n\n  ![sistaski](\u003cimages/allt som behölbs.PNG\u003e)\n\n  - **API environment variable** copy and paste it in the env.py file.\n\n  - Copy the **API key** and the **API secret** and put them into the env.py inside the **API environment variable** CLOUDINARY_URL=cloudinary://\u003cyour_api_key\u003e:\u003cyour_api_secret\u003e@dwxzdd3bf\n  - And put this in the **Config vars** section in heroku. is found **Settings** and scroll down to **Reveal Config vars**\n\n  Add the CLOUDINARY_URL=cloudinary://\u003cyour_api_key\u003e:\u003cyour_api_secret\u003e@dwxzdd3bf in this section.\n\n### Creating Google gmail for email.\n\nLogged in to Google account. and go into security on the left side of the screen.\n\n![firstgood](images/gåinhära.PNG)\n\nHere you need to do the **2 step verification** to get access to app password for you gmail.\n\npressed into the **2 step verification**\n\n![alt text](images/sedanhäraaaaaaa.PNG)\n\nScrolle down in the webpage untill you find this section och press in to **App password**\n\n![alt text](images/applösen.PNG)\n\nHere you created name for the app project. and you will get the key for the application.\nwhich you put into the **env.py** file.\n\n![alt text](images/skapalösen.PNG)\n### Creating env.py file\n\n**Preview of one in the list**\n\n\n![env](images/envpppp.PNG)\n\nCreate env.py for keeping some sensitive information hidden.\n\n- **Make sure its in the .gitignore file**\n\n![gitignore](images/gitignormee.PNG)\n\n- env.py\n\nThe domains or hosts Django API is allowed to run **ALLOWED_HOST**\n\n- ALLOWED_HOST = 'backendherokuapp.com'\n\n\n  Domain where frontend application is hosted **CLIENT_ORIGIN**\n\n- CLIENT_ORIGIN = \"frontend.herokuapp.com\"\n\n  The domain used during local frontend development. **CLIENT_ORIGIN_DEV**\n\n  in settings to CORS_ALLOWED_ORIGIN_REGEXES =  r\"^https://.*\\.codeinstitute-ide\\.net$\" to access from the react app.\n\n- CLIENT_ORIGIN_DEV = 'IDE-workspace-here-codeinstitute-ide.net'\n\n  API URL for Cloudinary, used for image uploads. **CLOUDINARY_URL**\n\n- CLOUDINARY_URL = 'API-for-CLOUDINARY-key-here'\n\n  The URL to your PostgreSQL database. **DATABASE_URL**\n\n- DATABASE_URL = \"database-secret-code-here\"\n\n  Django Secret Key for securing your app.**SECRET_KEY**\n\n- SECRET_KEY = \"django-secret-key-here\"\n\n  Dev for development. IF on DEBUG = True, if development off DEBUG = False **DEV**\n\n- DEV = \"for debug on/off\"\n\n  This contains in env.py the gmail account to admin.\n\n- EMAIL_HOST_USER = \"Email-to-admin-here\"\n\n  This contains the password to gmail account in env.py.\n\n- EMAIL_HOST_PASSWORD = \"password-to-gmail\"\n\n### creating config vars in heroku\n\n\u003cdetails\u003e\n\u003csummary\u003e \u003cstrong\u003eNavigate to settings to config vars\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n\u003cimg src=\"images/nyförframsidanapp.PNG\"\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e \u003cstrong\u003eConfig vars here\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n\u003cimg src=\"images/läggatrilldoin.PNG\"\u003e\n\u003c/details\u003e\n\n**things from the env.py file here.**\n\nDISABLE_COLLECTSTATIC is added inside the config vars.\n\nDISABLE_COLLECTSTATIC = 1 \n\nALLOWED_HOST = 'backendherokuapp.com'\n\nCLIENT_ORIGIN = \"frontend.herokuapp.com\"\n\nCLIENT_ORIGIN_DEV = 'IDE-workspace-here-codeinstitute-ide.net'\n\nCLOUDINARY_URL = 'API-for-CLOUDINARY-key-here'\n\nDATABASE_URL = \"database-secret-code-here\"\n\nSECRET_KEY = \"django-secret-key-here\"\n\nEMAIL_HOST_USER = \"Email-to-admin-here\"\n\nEMAIL_HOST_PASSWORD = \"password-to-gmail\"\n\n### deploy heroku application\n\nInstall **gunicorn** in the command in the terminal\n\nUpdate the requirements.txt (pip freeze \u003e requirements.txt)\n\n\nCreate a **Procfile file** with the content (release: python manage.py makemigrations \u0026\u0026 python manage.py migrate\n\nweb: gunicorn read_api.wsgi)\n\u003cdetails\u003e\n\u003csummary\u003e \u003cstrong\u003eProcfile\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n\u003cimg src=\"images/procfile.PNG\"\u003e\n\u003c/details\u003e\n\n\nIn settings put in the '.herokuapp.com'/ the app to **ALLOWED_HOSTS**.\n\nin heroku aswell.\n\n\u003cdetails\u003e\n\u003csummary\u003e \u003cstrong\u003ePutting in '.herokuapp.com'\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n\u003cimg src=\"images/nyförframsidanapp.PNG\"\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e \u003cstrong\u003eConfig vars here\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n\u003cimg src=\"images/läggatrilldoin.PNG\"\u003e\n\u003c/details\u003e\n\n\nNavigate to **\"Deploy\"** section between the **\"Resources\"** and **\"Metrics\"**.\n\n\u003cdetails\u003e\n\u003csummary\u003e \u003cstrong\u003eNavigate to Deploy and adding github repository\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n\u003cimg src=\"images/deployeengit.PNG\"\u003e\n\u003c/details\u003e\n\nGo to **Deployment method** and choose the **Github** and connect to your Repository project.\n\n\nGo down to **\"Manual deploy\"** section and press the **\"Deploy Branch\"**.\n\n\u003cdetails\u003e\n\u003csummary\u003e \u003cstrong\u003eDeploy Branch\u003c/strong\u003e\u003c/summary\u003e\n\u003cbr\u003e\n\u003cimg src=\"images/längstnerepåsidan.PNG\"\u003e\n\u003c/details\u003e\n\n### Problems with deployment on heroku.\nHade some problem with deploying the application since it was wrong in the config vars\nwith the **DATABASE_URL** and **CLIENT_ORIGIN** ,**CLOUDINARY_URL**.\nswitch the keys out and it worked.\nand problems with keeping the user logged in.\n# Installed Libraries\n\nasgiref==3.8.1\n\nbcrypt==4.2.0\n\ncloudinary==1.34.0\n\ndj-database-url==0.5.0\n\ndj-rest-auth==2.1.9\n\nDjango==4.2\n\ndjango-allauth==0.50.0\n\ndjango-cloudinary-storage==0.3.0\n\ndjango-cors-headers==4.6.0\n\ndjango-filter==24.3\n\ndjangorestframework==3.15.2\n\ndjangorestframework-simplejwt==5.3.1\n\ngunicorn==23.0.0\n\noauthlib==3.2.2\n\npillow==11.0.0\n\npsycopg2==2.9.10\n\nPyJWT==2.10.0\n\npython3-openid==3.2.0\n\npytz==2021.1\n\nrequests-oauthlib==2.0.0\n\nsqlparse==0.5.2\n\nurllib3==1.26.20\n\n# Technical Stack\n\n- Django REST: framework for creating API\n- Python: back-end for django rest api.\n- Gitpod: development\n- Git: version control\n- PostgreSQL: Database\n- Lucidchart: models Diagram.\n- Heroku: for deploying back-end.\n- dbdiagram: for database diagram.\n\n## Credits\n\n### Help from websites.\n- dbdiagram.io for database diagram.\n- https://www.django-rest-framework.org/ \n- Code institute project for Django REST framework.\n- lucid.app for making my models.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimalexanderandersson%2Fread-review-django-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimalexanderandersson%2Fread-review-django-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimalexanderandersson%2Fread-review-django-api/lists"}