{"id":25043670,"url":"https://github.com/husein14azimi/djtemplate","last_synced_at":"2026-05-14T20:07:44.270Z","repository":{"id":266891051,"uuid":"898372434","full_name":"husein14azimi/djtemplate","owner":"husein14azimi","description":"a template django project, using jwt for auth, `jdatetime` for date and time, and containing profile upload feature for auth users","archived":false,"fork":false,"pushed_at":"2025-01-01T08:42:02.000Z","size":81,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T17:19:29.597Z","etag":null,"topics":["django","django-rest-framework","djoser","jwt"],"latest_commit_sha":null,"homepage":"https://emcby1.pythonanywhere.com","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/husein14azimi.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}},"created_at":"2024-12-04T09:25:29.000Z","updated_at":"2025-01-01T08:42:05.000Z","dependencies_parsed_at":"2024-12-06T20:24:39.989Z","dependency_job_id":"2c7181cd-9d58-42ad-8677-fe8184d54d53","html_url":"https://github.com/husein14azimi/djtemplate","commit_stats":null,"previous_names":["husein14azimi/djtemplate"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/husein14azimi/djtemplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/husein14azimi%2Fdjtemplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/husein14azimi%2Fdjtemplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/husein14azimi%2Fdjtemplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/husein14azimi%2Fdjtemplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/husein14azimi","download_url":"https://codeload.github.com/husein14azimi/djtemplate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/husein14azimi%2Fdjtemplate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33041276,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"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","djoser","jwt"],"created_at":"2025-02-06T04:58:06.229Z","updated_at":"2026-05-14T20:07:44.250Z","avatar_url":"https://github.com/husein14azimi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cbr\u003e\u003c/br\u003e\n\u003cp align=\"center\"\u003e\nIN THE NAME OF GOD\n\u003c/p\u003e\n\n\n\u003cbr\u003e\u003c/br\u003e\n\n# django template project 💻\n\nthis is a template project to prevent coding for common usual stuff:\n* rest API\n* email-based authentication\n* jwt-token-based authentication\n* converting the gregorian date-time values from DB to jalali ones\n* implementing profile picture for users\n\n\n\u003e [!NOTE]\n\u003e this `readme` is to demonstrate the path to implement the profile picture feature in the project (and also deployment). the `jwt auth` and `jalali-datetime` features are built in the previous repositories. you can say this project is built on the basis of them.\n\n\n\n\n## coding flow for the profile picture feature\n\nfirst, create a directory in the base directory and name it `media`\n\nthen, write in the `core.settings`:\n```\nMEDIA_URL = '/media/'\nMEDIA_ROOT = BASE_DIR / 'media'\n```\n\nin the `core.urls`, add the following:\n```\nfrom django.conf import settings\nfrom django.conf.urls.static import static\n\nif settings.DEBUG:\n    urlpatterns += static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT)\n```\n\nthen, to test if the settings and urls work properly, you can manually paste a photo to the `media` directory and hit the url:\n\n`localhost:8000/media/\u003cpicture-name.png\u003e`\n\nso if you see the image, the configurations work properly so far.\n\n### adding the `profile_picture` to `Person` model (profile model)\n\nin other situations like pictures for a social account or pictures of a product or course, there can be more than one image associated to the parent model; but in here, we know that each user can have only one p. picture; therefore, we will define a new model named profile picture\n\n\n\u003cbr\u003e\u003c/br\u003e\n\u003cbr\u003e\u003c/br\u003e\n\u003cbr\u003e\u003c/br\u003e\n\u003cbr\u003e\u003c/br\u003e\n\u003cbr\u003e\u003c/br\u003e\n\n\n## Deployment\n\nthe project is currently ran on \u003chref\u003ehttps://emcby1.pythonanywhere.com\u003c/href\u003e.\n\nfirst, after creating a free account on \u003chref\u003ehttps://pythonanywhere.com\u003c/href\u003e, you have to start a console. after choosing `console: python 10` (the maximum version you can find there), in the `/home` directory, clone the repository:\n```\ngit clone https://github.com/husein14azimi/djtemplate\n```\nand then head to the `home/.virtualenvs` and run:\n```\npython -m venv venv_djtemplate\n```\n(the name of the virtual environment is mandatory)\n\nin the `.virtualenvs`, activate the venv:\n```\nsource venv_djtemplate/bin/activate\n```\nnow we have activated our empty venv. go to your cloned repository and use the requirements.txt you had created before:\n```\npip install -r requirements.txt\n```\n\n### web app\nhead to the `Web` section and click on the start a new web app. you will choose your technology here. DON'T choose the django; because it only provides `django4`; but rest_framework requires `django5`. therefore, we will use the `venv` we just created. in that list, click on the `manual` or the same meaning thing; that lets you use your `venv` instead of using pre-built engines. after you choose that, the redirects you directly to the **web app manage** section. in there, you are going to make some changes. let's start from the top:\n\n#### Code\nin this section, change the `source code` to the cloned repository (project's directory):\n```\n/home/emcby1/djtemplate\n```\n\nyour working directory should be set to\n```\n/home/\u003cusername\u003e/\n```\n\nchange the `wsgi` conf:\nclick on the link and in the file, configurations for each technology is written, but commented. find the `DJANGO` section and un-comment them. make some changes in the addressing and path:\n```\n# +++++++++++ DJANGO +++++++++++\n# To use your own django app use code like this:\nimport os\nimport sys\n\n# assuming your django settings file is at '/home/emcby1/mysite/mysite/settings.py'\n# and your manage.py is is at '/home/emcby1/mysite/manage.py'\npath = '/home/emcby1/djtemplate'\nif path not in sys.path:\n    sys.path.append(path)\n\nos.environ['DJANGO_SETTINGS_MODULE'] = 'core.settings'\n\n# then:\nfrom django.core.wsgi import get_wsgi_application\napplication = get_wsgi_application()\n```\nsave the file.\n\n\n#### virtualenv\nadd the path to your venv\n```\n/home/emcby1/.virtualenvs/venv_djtemplate\n```\nif you want to know whether you have provided the right link, you can click on the **start a console in this venv**\n\n\n#### static files\n\nin the dev phase (localhost), because of `DEBUG=True`, you will see the admin panel with writing no configuration. on the server, you have to make some changes on the project files (this means that you should go to the `files` section, click on each file, make the changes and save it) and after that, come back to the `web` section and do the last thing in this part.\n\n* write the static settings in the `core.settings`:\n    ```\n    STATIC_URL = '/static/'\n    STATIC_ROOT = '/home/emcby1/djtemplate/staticfiles'\n    ```\n    note that the `STATIC_ROOT` depends on your profile and project name.\n\n* run the `python manage.py collectstatic`\n\n* after the command, you are going to have to add the url and path to the static in the `Web` section: `static files` in the pythonanywhere dashboard.\n    ```\n    url: /static/\n    path: /home/emcby1/djtemplate/staticfiles\n    ```\n\n\n\n\n\n### Lastly,\nthere are some configurations on the server which are not done in the local storage:\n\n* adding the `pythonanywhere`'s given domain to the `core.settings.ALLOWED_HOSTS`:\n    ```\n    ALLOWED_HOSTS = ['127.0.0.1', 'localhost', 'emcby1.pythonanywhere.com',]\n    ```\n\n* click on the **reload app** in the `web` section.\n\n* if you don't see the project when you hit the url, try running\n    ```\n    python manage.py runserver\n    ```\n    once.\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhusein14azimi%2Fdjtemplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhusein14azimi%2Fdjtemplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhusein14azimi%2Fdjtemplate/lists"}