{"id":18869326,"url":"https://github.com/codersales/portfolio-project-4","last_synced_at":"2026-02-14T05:30:19.507Z","repository":{"id":43095557,"uuid":"470976306","full_name":"CoderSales/Portfolio-Project-4","owner":"CoderSales","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-18T05:04:05.000Z","size":6331,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-30T23:32:44.490Z","etag":null,"topics":["django"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/CoderSales.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}},"created_at":"2022-03-17T12:01:55.000Z","updated_at":"2022-03-25T19:48:18.000Z","dependencies_parsed_at":"2024-04-18T06:24:50.249Z","dependency_job_id":"df27cdd5-e723-4ed5-b8c1-1ab721eb7636","html_url":"https://github.com/CoderSales/Portfolio-Project-4","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"Code-Institute-Org/gitpod-full-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoderSales%2FPortfolio-Project-4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoderSales%2FPortfolio-Project-4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoderSales%2FPortfolio-Project-4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoderSales%2FPortfolio-Project-4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CoderSales","download_url":"https://codeload.github.com/CoderSales/Portfolio-Project-4/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239816510,"owners_count":19701753,"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","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"],"created_at":"2024-11-08T05:16:28.653Z","updated_at":"2026-02-14T05:30:19.481Z","avatar_url":"https://github.com/CoderSales.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Part 1 of 2: Non-stock README.md contents for Portfolio-Project-4\n\n## Design Approach\nMobile first\n\n## Documentation (Table of Contents)\nIn repository:\nNavigate to Documentation folder.\n\n**Main Documentation Files present:**\n- BUGS.md\n- CHALLENGES.md\n- DEBUG.md\n- DESIGN-DECISIONS.md\n- LOG.md\n- PLAN.md\n- REFERENCES.md\n\n### Django-Documentation (Subfolder)\n- Django-References.md\n- Steps-taken-in-setting-up-Django.md\n\n\n## Wireframe\nOverview ![Overview](assets/images/wireframe-overview.png)\n\nMobile First Home Page ![Mobile First Home Page](assets/images/mobile-first-home-page-compressed.png)\n\nDesktop Home Page ![Desktop Home Page](assets/images/desktop-home-page-compressed.png)\n\n## Elements of Website\n- Django\n- login\n\n\n## Design Thinking and Agile Approach\n(LMS Reference: Django Blog 002: Project Prerequisites)\n\n- Content important\n- Easy signup\n- Easy to engage\n\n- Problem statement:\nHow to develop a blog application that provides this functionality to the user?\n\n## Technologies used:\n- [Python](https://www.python.org/)\n- [Django](https://docs.djangoproject.com/en/4.0/topics/i18n/)\n- [HTML5](https://en.wikipedia.org/wiki/HTML5)\n- [CSS](https://en.wikipedia.org/wiki/CSS)\n- [JavaScript](https://en.wikipedia.org/wiki/JavaScript)\n- [GitHub](https://github.com/)\n- [Gitpod](https://www.gitpod.io/)\n- [Visual Studio Code](https://code.visualstudio.com/)\n- [Cloudinary](https://cloudinary.com/)\n- [Bootstrap](https://getbootstrap.com/docs/5.1/getting-started/contents/)\n- [heroku](https://en.wikipedia.org/wiki/Heroku)\n- [tiny png](https://tinypng.com/)\n- [diffchecker](https://www.diffchecker.com/)\n- [YouTrack JetBrains](https://www.jetbrains.com/youtrack/)\n\n## Theory\n### Django\ndjango schematic ![django schematic](assets/images/basic-django-compressed.png)\n[Django introduction](https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Introduction/basic-django.png)\n\n## Validation\n- [CSS Validation](https://beautifytools.com/javascript-validator.php)\n- [JS Validation](https://jigsaw.w3.org/css-validator/validator)\n\n## Deployed site:\n![responsive-design.png](assets/images/responsive-design.png)\n\n## Main References:\n## Template\n- [Template](https://github.com/Code-Institute-Org/gitpod-full-template)\n### LMS Tutorials:\n- Hello Django\n- I think therefore I blog\n- Building an eCommerce platform\n### Corresponding repositories:\n- [Hello Django](https://github.com/Code-Institute-Solutions/Hello-Django-Django3/tree/master/08-Testing)\n- [Django3blog](https://github.com/Code-Institute-Solutions/Django3blog/blob/master/12_final_deployment/)\n- [eCommerce platform](https://github.com/Code-Institute-Solutions/Boutique-Ado/tree/master/05-The-Home-Page)\n## Video on which post observation was made\n- [Two Vortex Rings Colliding in SLOW MOTION - Smarter Every Day 195](https://youtu.be/EVbdbVhzcM4?t=381)\n## Other references\n- Stackoverflow\n\nFor further references, see REFERENCES.md in Documentation folder.\n\n## Notes on deployment\nFor errors in the database and migrations, as a last resort:\n### Completely remove Django migrations and reset database\n\n1. Remove the all migrations files in project. Go through each of project apps' migration folders and remove everything inside, except the __init__.py file.\n\n2. Drop the database. If using Heroku Postgres, the command for this is: \n- `heroku login -i`\n\n- `heroku pg:reset DATABASE_URL`.\n\n    - Locally, delete the db.sqlite3 file.\nNote: only use if no other option.\n3.  Run the commands python3 manage.py makemigrations and python3 manage.py migrate to remake migrations and setup the new database.\n\n### Standard Deployment\n1. Once `python3 manage.py makemigrations` and `python3 manage.py migrate` are run\n`python3 manage.py createsuperuser`\n2. Push to GitHub and heroku\nNote: Must authorise GitHub to connect to heroku\n3. Either use Automatic deployment or manual deployment\n4. Click Open App\n\nNote:\nDEBUG = False\n\nFrom Django Documentation(https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/):\n`When DEBUG = False, Django doesn’t work at all without a suitable value for ALLOWED_HOSTS.`\n\n\n## Agile Methodology:\n\n\n\n### Sprint n-1: \n#### Add CRUD Functionality\n\n###### Analyze\n\n###### Plan\nReview tutorials for 'I think therefore I blog'\n###### Design\nRewatch videos\n###### Build\nEdit CRUD functionality\n###### Test\nTest CRUD functionality\n- Can user add post?\n- Can user delete post?\n- Can user update post?\n- Can user Read post?\n###### Review\nTBC\n###### Launch\nTBC\n### Sprint n:\n#### Steps: \n##### Analyze:\n###### Bug found while working on adding CRUD functionality\n```need to provide CLOUDINARY_STORAGE dictionary with CLOUD_NAME, API_SECRET and API_KEY in the settings or set CLOUDINARY_URL variable```\n### Iteration 2 of Sprint:\n##### Plan:\nDefer until revising deployment section of project\n##### Design:\nTBC\n##### Build:\nTBC\n##### Test:\nchange DEBUG to:\n```DEBUG = 'DEVELOPMENT' in os.environ```\nHowever, this does not resolve the issue.\n\nAdded CLOUDINARY_URL to Gitpod environment variables on Gitpod dashboard.\n\nRestarted Gitpod Workspace\n\n```python3 manage.py runserver```\n\nRuns server.\n##### Review:\nThe 3 steps were:\n1. change DEBUG in settings.py\n2. add CLOUDINARY_URL to Gitpod environment variables on Gitpod dashboard\n3. restart Gitpod workspace\n##### Launch:\n###### To run server locally run:\n```python3 manage.py runserver```\n\n\n###### To run server on heroku:\nGo to Heroku \n### Iteration 2:\n\n#### Second bug after getting local server working\n##### Analyze\nGet results of first iteration:\n```\nOperationalError at /\nno such table: Your_Thoughts_post\nRequest Method:\tGET\nRequest URL:\thttp://localhost:8000/\nDjango Version:\t3.2\nException Type:\tOperationalError\nException Value:\t\nno such table: Your_Thoughts_post\nException Location:\t/workspace/.pip-modules/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py, line 423, in execute\nPython Executable:\t/home/gitpod/.pyenv/versions/3.8.11/bin/python3\nPython Version:\t3.8.11\nPython Path:\t\n['/workspace/Portfolio-Project-4',\n '/home/gitpod/.pyenv/versions/3.8.11/lib/python38.zip',\n '/home/gitpod/.pyenv/versions/3.8.11/lib/python3.8',\n '/home/gitpod/.pyenv/versions/3.8.11/lib/python3.8/lib-dynload',\n '/workspace/.pip-modules/lib/python3.8/site-packages',\n '/home/gitpod/.pyenv/versions/3.8.11/lib/python3.8/site-packages']\nServer time:\tTue, 09 Aug 2022 21:28:07 +0000\n```\n##### Plan\nTest if it deploys on heroku\n\n##### Design\nTBC\n##### Build\nTBC\n##### Test\nTest if it deploys on heroku\n##### Review\nTBC\n##### Launch\nTBC\n\n#### 3rd iteration:\nGo to heroku to check app is working\n##### Analyze\nTBC\n##### Plan\nGo to heroku to check app is working\n##### Design\nTBC\n##### Build\nTBC\n##### Test\nGo to heroku to check app is working\n##### Review\nTBC\n##### Launch\nTBC\n#### Reference:\n- [Iteration vs Sprint vs cadence in Agile [Meaning and difference]](https://bigpicture.one/sprint-cadence-iteration/)\n\n\n#### More Agile Theory\n\n```\nWhat Is the Agile Sprint Cycle?\nThe Agile sprint cycle, or workflow, is the repetitive process that developers use to tackle a development project. A software project can take as many as ten sprint cycles.\n\nAlthough there is room for variation, most sprint cycles break down like this:\n\nPlanning\n\nBacklog\n\nThe Sprint\n\nDaily Scrum\n\nOutcome\n\nSprint End\n\nSprint review.\n\nSprint retrospective.\n```\n#### Reference for the above quoted paragraphs\n- [Agile Sprint in Software Development: Definition, Process, and Roles Involved: What Is the Agile Sprint Cycle?](https://www.simplilearn.com/agile-sprint-article#:~:text=The%20Agile%20sprint%20cycle%2C%20or,many%20as%20ten%20sprint%20cycles.)\n\n# Log of work\n## Bug continued\n\n```\nOperationalError at /\nno such table: Your_Thoughts_post\nRequest Method:\tGET\nRequest URL:\thttp://localhost:8000/\nDjango Version:\t3.2\nException Type:\tOperationalError\nException Value:\t\nno such table: Your_Thoughts_post\n```\n\n### Potential fix:\nRun migrations\n\n### Continuous log of Terminal\n\n```\n  File \"/workspace/.pip-modules/lib/python3.8/site-packages/django/db/backends/utils.py\", line 84, in _execute\n    return self.cursor.execute(sql, params)\n  File \"/workspace/.pip-modules/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py\", line 423, in execute\n    return Database.Cursor.execute(self, query, params)\ndjango.db.utils.OperationalError: no such table: Your_Thoughts_post\n[10/Aug/2022 09:50:49] \"GET / HTTP/1.1\" 500 175476\nNot Found: /favicon.ico\n[10/Aug/2022 09:50:50] \"GET /favicon.ico HTTP/1.1\" 404 3280\n^Cgitpod /workspace/Portfolio-Project-4 (main) $ python3 manage.py makemigrations --dry-run\nMigrations for 'django_summernote':\n  /workspace/.pip-modules/lib/python3.8/site-packages/django_summernote/migrations/0003_alter_attachment_id.py\n    - Alter field id on attachment\ngitpod /workspace/Portfolio-Project-4 (main) $ python3 manage.py makemigrations\nMigrations for 'django_summernote':\n  /workspace/.pip-modules/lib/python3.8/site-packages/django_summernote/migrations/0003_alter_attachment_id.py\n    - Alter field id on attachment\ngitpod /workspace/Portfolio-Project-4 (main) $ python3 manage.py migrate --plan\nPlanned operations:\ncontenttypes.0001_initial\n    Create model ContentType\n    Alter unique_together for contenttype (1 constraint(s))\nauth.0001_initial\n    Create model Permission\n    Create model Group\n    Create model User\nYour_Thoughts.0001_initial\n    Create model Post\n    Create model Comment\naccount.0001_initial\n    Create model EmailAddress\n    Create model EmailConfirmation\naccount.0002_email_max_length\n    Alter field email on emailaddress\nadmin.0001_initial\n    Create model LogEntry\nadmin.0002_logentry_remove_auto_add\n    Alter field action_time on logentry\nadmin.0003_logentry_add_action_flag_choices\n    Alter field action_flag on logentry\ncontenttypes.0002_remove_content_type_name\n    Change Meta options on contenttype\n    Alter field name on contenttype\n    Raw Python operation\n    Remove field name from contenttype\nauth.0002_alter_permission_name_max_length\n    Alter field name on permission\nauth.0003_alter_user_email_max_length\n    Alter field email on user\nauth.0004_alter_user_username_opts\n    Alter field username on user\nauth.0005_alter_user_last_login_null\n    Alter field last_login on user\nauth.0006_require_contenttypes_0002\nauth.0007_alter_validators_add_error_messages\n    Alter field username on user\nauth.0008_alter_user_username_max_length\n    Alter field username on user\nauth.0009_alter_user_last_name_max_length\n    Alter field last_name on user\nauth.0010_alter_group_name_max_length\n    Alter field name on group\nauth.0011_update_proxy_permissions\n    Raw Python operation -\u003e     Update the content_type of prox…\nauth.0012_alter_user_first_name_max_length\n    Alter field first_name on user\ndjango_summernote.0001_initial\n    Create model Attachment\ndjango_summernote.0002_update-help_text\n    Alter field name on attachment\ndjango_summernote.0003_alter_attachment_id\n    Alter field id on attachment\nsessions.0001_initial\n    Create model Session\nsites.0001_initial\n    Create model Site\nsites.0002_alter_domain_unique\n    Alter field domain on site\nsocialaccount.0001_initial\n    Create model SocialAccount\n    Create model SocialApp\n    Create model SocialToken\n    Alter unique_together for socialtoken (1 constraint(s))\n    Alter unique_together for socialaccount (1 constraint(s))\nsocialaccount.0002_token_max_lengths\n    Alter field uid on socialaccount\n    Alter field client_id on socialapp\n    Alter field key on socialapp\n    Alter field secret on socialapp\nsocialaccount.0003_extra_data_default_dict\n    Alter field extra_data on socialaccount\ngitpod /workspace/Portfolio-Project-4 (main) $ python3 manage.py migrate\nOperations to perform:\n  Apply all migrations: Your_Thoughts, account, admin, auth, contenttypes, django_summernote, sessions, sites, socialaccount\nRunning migrations:\n  Applying contenttypes.0001_initial... OK\n  Applying auth.0001_initial... OK\n  Applying Your_Thoughts.0001_initial... OK\n  Applying account.0001_initial... OK\n  Applying account.0002_email_max_length... OK\n  Applying admin.0001_initial... OK\n  Applying admin.0002_logentry_remove_auto_add... OK\n  Applying admin.0003_logentry_add_action_flag_choices... OK\n  Applying contenttypes.0002_remove_content_type_name... OK\n  Applying auth.0002_alter_permission_name_max_length... OK\n  Applying auth.0003_alter_user_email_max_length... OK\n  Applying auth.0004_alter_user_username_opts... OK\n  Applying auth.0005_alter_user_last_login_null... OK\n  Applying auth.0006_require_contenttypes_0002... OK\n  Applying auth.0007_alter_validators_add_error_messages... OK\n  Applying auth.0008_alter_user_username_max_length... OK\n  Applying auth.0009_alter_user_last_name_max_length... OK\n  Applying auth.0010_alter_group_name_max_length... OK\n  Applying auth.0011_update_proxy_permissions... OK\n  Applying auth.0012_alter_user_first_name_max_length... OK\n  Applying django_summernote.0001_initial... OK\n  Applying django_summernote.0002_update-help_text... OK\n  Applying django_summernote.0003_alter_attachment_id... OK\n  Applying sessions.0001_initial... OK\n  Applying sites.0001_initial... OK\n  Applying sites.0002_alter_domain_unique... OK\n  Applying socialaccount.0001_initial... OK\n  Applying socialaccount.0002_token_max_lengths... OK\n  Applying socialaccount.0003_extra_data_default_dict... OK\n```\n\n# Sprint Iteration 1: Fix local website\n## PROBLEM STATEMENT:\n    - At this point the remote website was working, but the local version was not.  The remote deployment was a few commits behind.\n## Part 1 of fix: Identify cause of problem:    \n    - So, the first part of the fix was to identify that the DATABASE_URL variable in this if statement:\n    \n    ```\n    if 'DATABASE_URL' in os.environ:\n        DATABASES = {\n            'default': dj_database_url.parse(os.environ.get('DATABASE_URL'))\n        }\n    ```\n    \n    meant that the settings.py file was looking for DATABASE_URL in whatever environment the site was deployed in.\n    - Therefore, when the site was deployed in the heroku environment, because the DATABASE_URL was present as an environment variable,\n      the site content was able to be displayed on the version of the site deployed and running on heroku.\n    - However, when the site was deployed in the GitPod environment, since the DATABASE_URL was not present as an environment variable,\n      the site content was not able to be displayed on the version of the site being run from the local GitPod server.\n## Part 2 of the fix: Add variable to environment\n    - The second part of the fix was to add the DATABASE_URL variable present in the heroku workspace environment variables to the GitPod workspace environment variables.\n    - However, the local site still did not display content.  Therefore, the GitPod workspace was stopped and restarted from the [GitPod Dashboard](https://gitpod.io/dashboard).\n    - This restart fixed the issue aand the content now displayed on local as well.\n\n\n# Sprint Iteration 2: Testing and Fix Content\n## Testing\n### To Check \"Like\" functionality\n#### Test \"Like\" functionality.\nTry to like post\n-  Not possible as not logged in\n#### First, login.\nAs local environment was stopped in the previous iteration of this sprint, during this iteration, \n- Then logged in.\n#### Test Like functionality.\nTry to like post.\nSuccess.\n\n#### Test Add Comment Functionality (Create in CRUD)\nAdded comment.\nClicked Submit Button.\n##### Bug [Resolved]\nComment did not display on website.\n##### Debug [Resolved]\nLogged in as admin, clicked on Comments.\nComment present.\nClicked on Users.\nUser not verified.\nTicked verified box.\nNow comment displays for user.\n[Resolved]\nDetail on fix necessary in code below for comment not displaying:\n# Fix post functionality\n## In the Your_Thoughts App folder:\n### In the views.py post function\nMove the first return statement to after the \"if else block\" and comment everything in the function that comes afterwards.\n\n### In the urls.py\n#### In urlpatterns\nadd post/ to the start of the paths for:\n- slug\n    - render views.PostDetail as view\n- like/slug\n    - render views.PostDetail as view\n\n\n## Documenting lines of code\n### Overview (of views in Your_Thoughts App)\nThere are two main folders in this project.  \nOne is called Profile_Project_4 (PP4 Proj).  This is the project folder.\nThe other is the Your_Thoughts App (YT App).\nThe YT App has admin.py, apps.py forms.py models.py urls.py and view.py\n- The views file has\n    - class PostList(generic.ListView):\n    - class PostDetail(View):\n        - def get(self, request, slug, *args, **kwargs):\n            - return render(request,\"post_detail.html\",{post, comments, commented, liked, comment_form})\n        - def post(self, request, slug, *args, **kwargs):\n            -         if post.likes.filter(id=self.request.user.id).exists():\n                        liked = True\n    -                 else:\n                        post.likes.add(request.user)\n    -         comment_form = CommentForm(data=request.POST)\n        if comment_form.is_valid():\n        else:\n            comment_form = CommentForm()\n        return HttpResponseRedirect(reverse('post_detail', args=[slug]))\nclass PostLike(View):\n    def post(self, request, slug, *args, **kwargs):\n        if post.likes.filter(id=request.user.id).exists():\n        else:\n            post.likes.add(request.user)\n        return HttpResponseRedirect(reverse('post_detail', args=[slug]))\ndef get_comment(user_request):\n    return render(user_request, 'Your_Thoughts/comment-page.html', context)\ndef add_post(user_request):\n    return render(user_request, 'Your_Thoughts/add_post.html', context)\ndef edit_post(user_request, post_id):\n    return render(user_request, 'Your_Thoughts/edit_post.html', context)\ndef toggle_post(user_request, post_id):\n    return redirect('get_comment')\ndef delete_post(user_request, post_id):\n    return redirect('get_comment')\n\n## Issue found with website\n### Individual Comment approval\nCurrently the site allows a user who is logged to post a comment.\nHowever, in order for this comment to be displayed, currently an admin user must access the admin page, go to the User/Comment and approve the comment.  Currently this must be done for each individual comment.\n\n# Testing\n## Run test \nCheck to see if changing from approved=True to approved=False\nallows a user to post an unapproved comment.\nTest failed, so this change was not pushed to version control.\n# Error testing django debug toolbar\nExpected: Local server to load site\nActual: Site not loading received error.\nTraceback from error:\n```\nTraceback (most recent call last):\n  File \"/home/gitpod/.pyenv/versions/3.8.11/lib/python3.8/threading.py\", line 932, in _bootstrap_inner\n    self.run()\n  File \"/home/gitpod/.pyenv/versions/3.8.11/lib/python3.8/threading.py\", line 870, in run\n    self._target(*self._args, **self._kwargs)\n  File \"/workspace/.pip-modules/lib/python3.8/site-packages/django/utils/autoreload.py\", line 64, in wrapper\n    fn(*args, **kwargs)\n  File \"/workspace/.pip-modules/lib/python3.8/site-packages/django/core/management/commands/runserver.py\", line 157, in inner_run\n    handler = self.get_handler(*args, **options)\n  File \"/workspace/.pip-modules/lib/python3.8/site-packages/django/contrib/staticfiles/management/commands/runserver.py\", line 31, in get_handler\n    handler = super().get_handler(*args, **options)\n  File \"/workspace/.pip-modules/lib/python3.8/site-packages/django/core/management/commands/runserver.py\", line 78, in get_handler\n    return get_internal_wsgi_application()\n  File \"/workspace/.pip-modules/lib/python3.8/site-packages/django/core/servers/basehttp.py\", line 49, in get_internal_wsgi_application\n    raise ImproperlyConfigured(\ndjango.core.exceptions.ImproperlyConfigured: WSGI application 'Profile_Project_4.wsgi.application' could not be loaded; Error importing module.\n``` \nActions:\nRemoved recently added code for django debug toolbar. (from INSTALLED_APPS and MIDDLEWARE)\n\n# Debugging\n## 1\nUnable to login as admin on local\n### Working towards solution\nCheck django-admin version\nreturned 4.1\nwhich was unexpected as 3.2 is in requirements.txt\n\n#### Aside\nFor Django 4.1 need to add another csrf variable (CSRF_TRUSTED_ORIGINS) to settings.py\nwith both the local app url (without trailing forwardslash) and heroku deployed app url (added with and without trailing forwardslash)\n### Fix\npip install -r requirements.txt\nthis reverted to django 3.2\n### Update \nCheck re dependabot security update\nEnable dependabot updates in GitHub settings for repository.\nCheck dependabot security update recommendations\n#### Fix \nChange django version from 3.2 to 3.2.14 in requirements.txt\nto patch critical vulnerability to sql injection.\n### Update\nPer dependabot:\nDjango 3.2 before 3.2.15 and 4.0 before 4.0.7 vulnerable to Reflected File Download attack #16\n#### Fix\nChange requirements.txt\nfrom 3.2.14 to 3.2.15\n### Update and fix\nPer dependabot:\nKey confusion through non-blocklisted public key formats #14\nAction taken:\nUpdate requirements.txt from pyjwt 2.3.0 to 2.4.0\n### Update\nrun\n```pip install  -r requirements.txt```\n## 2\nInternal server error on heroku\nran ```heroku logs --app your-thoughts-app```\nModuleNotFoundError: debug toolbar\n### Fix:\nRemove debug_toolbar from urls.py\n\n# End of Sprint\n## Finished sprint to address issue with comment approval\n### Successful Google search string:\n```why do i need to approve every single comment django project```\n### Result: \n- [automatically accept comments](https://stackoverflow.com/questions/2553330/how-to-automatically-accept-comments-from-authenticated-users-in-django-contrib)\n\n### Fix:\nChanged False to True in models.py Comments model\napproved field, so that comments are \nautomatically approved, and so appear \nwhen added by user.\n\n# Debug\nWhen testing the deployed heroku app,\nreceived an internal server error.\nThis was resolved by doing a ```pip install -r requirements.txt```,\nwhich changed django version from \n4.1 (which had been displaying when ```django-admin version```\nwas run) to 3.2, which was then subsequently updated to\n3.2.15 to address dependabot flagged security vulnerabilities.\n\n# Next sprint\n## Testing of CRUD functionality / Planning post testing\n- With regard to Comments\n    1. Should allow user to create, read, update and delete comments.\n        - There should be an edit functionality in the comment. \n    2. Should display toasts for crud operations.\n\n\n# Further work\n## The following sprints\n- map django schema\n- try installing test package(s)\n\n# Next sprint\n- Rolled back migrations\n- Got an error\n- Uninstalled allauth\n- Rolled forward migrations\n- Reinstalled allauth\n\n# Notes on Django theory\nDjango uses a specific case of MVC called MVT, Model View Template.\nTo write them so that the roles line up vertically would be as follows:\nMVC\nMTV\nIn Django the MVC Model is the model\nThe MVC \"View\" (not to be confused with Django's Views) is the html template. (The template is the user interface.)\nThe MVC Controller is the View. The views are where the logic lives.\n\n- [ServerSide Web Frameworks Django Structure]\n\n# Sprint:\n## Plan:\nMake admin functions available to the user.\n### Notes / Thoughts:\n- It will need to check that the current user is the same as the comment author\n    - So this will be something like:\n    \t- if user === comment.author\n        - then do some action\n    - Try to implement this now.\n### Progress:\nNoted in views py that class PostEdit (inheriting from Django View):\n- only has a get method\n- no post method.\n# References\n- [django debug panel](https://github.com/recamshak/django-debug-panel)\n- [CSRF_TRUSTED_ORIGINS required in settings.py](https://github.com/catmaid/CATMAID/issues/1781)\n- [How to automatically accept comments from authenticated users in django.contrib.comments](https://stackoverflow.com/questions/2553330/how-to-automatically-accept-comments-from-authenticated-users-in-django-contrib)\n- [Heroku giving 500 error with little information + Internal Server Error](https://stackoverflow.com/questions/46021463/heroku-giving-500-error-with-little-information-internal-server-error)\n- [Forbidden (403) CSRF verification failed. Request aborted. Reason given for failure: Origin checking failed does not match any trusted origins](https://stackoverflow.com/questions/70285834/forbidden-403-csrf-verification-failed-request-aborted-reason-given-for-fail)\n## CRUD References\n- [PP4_masterclass](https://github.com/lechien73/PP4_masterclass/commits/main)\n\n# Part 2 of 2: Stock Template for README.md\n\n![CI logo](https://codeinstitute.s3.amazonaws.com/fullstack/ci_logo_small.png)\n\nWelcome Coder731,\n\nThis is the Code Institute student template for Gitpod. We have preinstalled all of the tools you need to get started. It's perfectly ok to use this template as the basis for your project submissions.\n\nYou can safely delete this README.md file, or change it for your own project. Please do read it at least once, though! It contains some important information about Gitpod and the extensions we use. Some of this information has been updated since the video content was created. The last update to this file was: **September 1, 2021**\n\n## Gitpod Reminders\n\nTo run a frontend (HTML, CSS, Javascript only) application in Gitpod, in the terminal, type:\n\n`python3 -m http.server`\n\nA blue button should appear to click: _Make Public_,\n\nAnother blue button should appear to click: _Open Browser_.\n\nTo run a backend Python file, type `python3 app.py`, if your Python file is named `app.py` of course.\n\nA blue button should appear to click: _Make Public_,\n\nAnother blue button should appear to click: _Open Browser_.\n\nIn Gitpod you have superuser security privileges by default. Therefore you do not need to use the `sudo` (superuser do) command in the bash terminal in any of the lessons.\n\nTo log into the Heroku toolbelt CLI:\n\n1. Log in to your Heroku account and go to *Account Settings* in the menu under your avatar.\n2. Scroll down to the *API Key* and click *Reveal*\n3. Copy the key\n4. In Gitpod, from the terminal, run `heroku_config`\n5. Paste in your API key when asked\n\nYou can now use the `heroku` CLI program - try running `heroku apps` to confirm it works. This API key is unique and private to you so do not share it. If you accidentally make it public then you can create a new one with _Regenerate API Key_.\n\n------\n\n## Release History\n\nWe continually tweak and adjust this template to help give you the best experience. Here is the version history:\n\n**September 1 2021:** Remove `PGHOSTADDR` environment variable.\n\n**July 19 2021:** Remove `font_fix` script now that the terminal font issue is fixed.\n\n**July 2 2021:** Remove extensions that are not available in Open VSX.\n\n**June 30 2021:** Combined the P4 and P5 templates into one file, added the uptime script. See the FAQ at the end of this file.\n\n**June 10 2021:** Added: `font_fix` script and alias to fix the Terminal font issue\n\n**May 10 2021:** Added `heroku_config` script to allow Heroku API key to be stored as an environment variable.\n\n**April 7 2021:** Upgraded the template for VS Code instead of Theia.\n\n**October 21 2020:** Versions of the HTMLHint, Prettier, Bootstrap4 CDN and Auto Close extensions updated. The Python extension needs to stay the same version for now.\n\n**October 08 2020:** Additional large Gitpod files (`core.mongo*` and `core.python*`) are now hidden in the Explorer, and have been added to the `.gitignore` by default.\n\n**September 22 2020:** Gitpod occasionally creates large `core.Microsoft` files. These are now hidden in the Explorer. A `.gitignore` file has been created to make sure these files will not be committed, along with other common files.\n\n**April 16 2020:** The template now automatically installs MySQL instead of relying on the Gitpod MySQL image. The message about a Python linter not being installed has been dealt with, and the set-up files are now hidden in the Gitpod file explorer.\n\n**April 13 2020:** Added the _Prettier_ code beautifier extension instead of the code formatter built-in to Gitpod.\n\n**February 2020:** The initialisation files now _do not_ auto-delete. They will remain in your project. You can safely ignore them. They just make sure that your workspace is configured correctly each time you open it. It will also prevent the Gitpod configuration popup from appearing.\n\n**December 2019:** Added Eventyret's Bootstrap 4 extension. Type `!bscdn` in a HTML file to add the Bootstrap boilerplate. Check out the \u003ca href=\"https://github.com/Eventyret/vscode-bcdn\" target=\"_blank\"\u003eREADME.md file at the official repo\u003c/a\u003e for more options.\n\n------\n\n## FAQ about the uptime script\n\n**Why have you added this script?**\n\nIt will help us to calculate how many running workspaces there are at any one time, which greatly helps us with cost and capacity planning. It will help us decide on the future direction of our cloud-based IDE strategy.\n\n**How will this affect me?**\n\nFor everyday usage of Gitpod, it doesn’t have any effect at all. The script only captures the following data:\n\n- An ID that is randomly generated each time the workspace is started.\n- The current date and time\n- The workspace status of “started” or “running”, which is sent every 5 minutes.\n\nIt is not possible for us or anyone else to trace the random ID back to an individual, and no personal data is being captured. It will not slow down the workspace or affect your work.\n\n**So….?**\n\nWe want to tell you this so that we are being completely transparent about the data we collect and what we do with it.\n\n**Can I opt out?**\n\nYes, you can. Since no personally identifiable information is being captured, we'd appreciate it if you let the script run; however if you are unhappy with the idea, simply run the following commands from the terminal window after creating the workspace, and this will remove the uptime script:\n\n```\npkill uptime.sh\nrm .vscode/uptime.sh\n```\n\n**Anything more?**\n\nYes! We'd strongly encourage you to look at the source code of the `uptime.sh` file so that you know what it's doing. As future software developers, it will be great practice to see how these shell scripts work.\n\n---\n\nHappy coding!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodersales%2Fportfolio-project-4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodersales%2Fportfolio-project-4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodersales%2Fportfolio-project-4/lists"}