{"id":16417544,"url":"https://github.com/zagaran/django-template","last_synced_at":"2025-04-17T14:13:41.997Z","repository":{"id":37467600,"uuid":"416080304","full_name":"zagaran/django-template","owner":"zagaran","description":"Django Template is a cookiecutter that automates the installation and configuration of Django with optional features.","archived":false,"fork":false,"pushed_at":"2024-08-09T21:22:42.000Z","size":192,"stargazers_count":13,"open_issues_count":34,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-17T12:32:48.675Z","etag":null,"topics":[],"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/zagaran.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-10-11T20:42:34.000Z","updated_at":"2025-01-23T13:48:40.000Z","dependencies_parsed_at":"2023-01-19T11:30:26.228Z","dependency_job_id":"fc0352a4-8e52-4724-8168-76a88ffc0e64","html_url":"https://github.com/zagaran/django-template","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zagaran%2Fdjango-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zagaran%2Fdjango-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zagaran%2Fdjango-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zagaran%2Fdjango-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zagaran","download_url":"https://codeload.github.com/zagaran/django-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249347325,"owners_count":21255148,"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":[],"created_at":"2024-10-11T07:11:34.180Z","updated_at":"2025-04-17T14:13:41.978Z","avatar_url":"https://github.com/zagaran.png","language":"Python","readme":"# How To Use This Template\n\nThis template is a [cookiecutter](https://github.com/cookiecutter/cookiecutter) template.  Create a project from it using the following:\n```\npip install \"cookiecutter\u003e=1.7.0\"\ncookiecutter https://github.com/zagaran/django-template\n```\n\nThe cookiecutter command will give you an interactive prompt to choose which optional features to inlcude (see below)\n\nOnce you have cloned the project, [create a virtual environment](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment)\n\nThen run the following:\n\n```\npip install pip-tools\npip-compile requirements.in --upgrade\npip-compile requirements-dev.in --upgrade\npip install -r requirements-dev.txt\ncp config/.env.example config/.env\npython manage.py makemigrations\n\n# If using the `elastic_beanstalk` feature\ngit add --chmod=+x -- .platform///*.sh\n\n# Then see the generated README in your new project for the rest of the local setup instructions\n```\n\nIf you have an existing project, you can see a project based on this template here: https://github.com/zagaran/sample-django-app\n\n# Included Optional Features\n\nThere are a number of optional features that are present in this template.  You will be prompted for whether to include each one as part of running `cookiecutter`.\n\n## `feature_annotations` (off by default)\n\nIf you turn feature annotations on, the code for each optional feature will be bracketed by comments such as\n`# START_FEATURE feature_name` and `# END_FEATURE feature_name`.\n\n\n## `reference_examples` (on by default)\nIf you turn on reference examples, the codebase will have a number of reference examples.  These are all marked with one of the following comments:\n\n```\n# TODO: delete me; this is just a reference example\n// TODO: delete me; this is just a reference example\n{# TODO: delete me; this is just a reference example #}\n```\n\n\n## Django messages integration with Bootstrap (`bootstrap_messages`)\n\n\n## Crispy Forms integration (`crispy_forms`)\n\n\n## Debug Toolbar integration (`debug_toolbar`)\n\n\n## Django-React integration, aka Djangre (`django_react`)\n\n### Files\n\nThe following files and folders are only needed if `django_react` is a desired feature in your app and can be safely\ndeleted from projects which do not leverage the feature.\n\n- `nwb.config.js`\n- `package.json`\n- `webpack-stats.json`\n- `config/webpack_loader.py`\n- `src/`\n\n### Additional Setup\n\nWhen using this feature, make sure to install the Node.js requirements using the manager of your choice\n(either `npm install` or `yarn install` will work) before proceeding with development.\n\n### Special Consideration for Running\n\nFor development on localhost when using Django-React, you should run the following command in a separate terminal to\nyour standard `runserver` command.\n\n```\nnwb serve --no-vendor  # Note: refer to the nwb docs on when to use --no-vendor vs not\n```\n\nIf you have configured everything correctly, you should see each command complete and notify you\nthat the project is ready to be viewed.\n\n- If you include `nwb` as a dependency, you can use the locally-installed `nwb` by running `node_modules/.bin/nwb serve --no-vendor` instead of relying on a globally installed `nwb`.\n\n### Adding a new React component\n\nIn this paradigm, React components are compiled and injected into the standard Django template. This means we can take\nadvantage of the built-in templating functionality of Django and, with a bit of elbow grease, use the power of React to\nmake those templates responsive.\n\n`django-react-loader` uses the same basic pattern for any component:\n\n1. First, ensure that the library is loaded in your template: `{% load django_react_components %}`\n2. Next, ensure that you have rendered the React runtime bundle: `{% render_bundle 'runtime' %}`\n   - Note that you only have to do this once per page where React components will be used.\n3. Finally, load your React component on the page. `{% react_component 'Component' %}`\n    - You can add any number of props as named keywords, e.g. `{% react_component 'Home' id='home' prop1=value_from_context %}`\n    - You can also choose to pass props as an object instead of individual kwargs, e.g. `{% react_component 'Hello' id='hello' props=sample_props %}`.\n\n### Preparing for deployment\n\nThe preferred option for deployment is to add the below compilation step to the deployment configuration rather than\nbuilding it locally. However, if you wish to build the app locally:\n\n- run `nwb build --no-vendor`. This will generate or replace a `webpack_bundles` folder in your `/static` folder\n  populated with the compiled React components. This then allows `collectstatic` to collect these static assets and\n  make them available via the usual static assets pipeline set up in the deploy configuration.\n  - Note that calling `nwb build` does not remove existing compiled data from your static folder. If you are building \n  static assets locally and committing them to the repo rather than implementing a deploy compilation step, it is import \n  to delete `/static/webpack_bundles` (in addition to wherever your existing static files are, e.g. \n  `/staticfiles/webpack_bundles`) before running another build, as even without code changes NWB will generate new \n  compiled JS files without removing the old ones. If you have implemented a `collecstatic` step in your deployment,\n  ensure that existing webpack bundles are deleted before the new assets are generated by NWB.\n\n### Other notes\n\n- If you use `nwb serve` in your local development environment, you may see a persistent XHR error in the console -- a\nrequest by the app to something like `http://localhost:8000/sockjs-node/info?t=123456789`. This is normal and will\nnot appear on production or otherwise effect the function of your app - it is because the React components are being\nserved by the browser in a different environment than the React components expect to be in.\n\n\n## AWS SES integration (`django_ses`)\n\n\n## Third-party authentication integrations (`django_social`)\n\n\n## AWS S3 (or other cloud blob storage) integration (`django_storages`)\n\n## Docker integration (`docker`)\n\n\n## Elastic Beanstalk deployment (`elastic_beanstalk`)\n\nAs a default for web applications, we strongly recommend using Elastic Beanstalk.\n\nTo create a new deployment, [set up your local AWS credentials](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) e.g. ~/.aws/config,\n\nEnsure shell files in the `.platform` directory are executable according to git.\nYou can check if they are executable via `git ls-files -s .platform`;\nyou should see `100755` before any shell files in the output of this command.\nIf you see `100644` before any of your shell files,\nrun `git add --chmod=+x -- .platform/*/*/*.sh` to make them executable.\n\nSet desired parameters `.elasticbeanstalk/eb-create-environment.yml`\n\nUse [eb-create-environment](https://github.com/zagaran/eb-create-environment/):\n```\neb-create-environment --config .elasticbeanstalk/eb-create-environment.yml\n```\n\nTo update an existing deployment\n```\neb deploy [ENVIRONMENT_NAME]\n```\n\nTo SSH into a deployment\n\nUse [eb-ssm](https://github.com/zagaran/eb-ssm/):\n```\neb-ssm [ENVIRONMENT_NAME]\n```\n\n## Pre-commit hooks (`pre_commit`)\nYou can configure pre-commit with `.pre-commit-config.yaml`\n\nSee https://pre-commit.com/hooks.html for more hook options.\n\nTo run style checks and desired formatters:\n```\npre-commit run --all-files\n```\nIf wish to install pre-commit as a pre-commit git hook, you can run (optional):\n```\npre-commit install\n```\n\n\n## Sass compilation (`sass_bootstrap`)\n\nUse this feature to enable Sass processing and Bootstrap styling.\n\nWhile you can just include Bootstrap's styling/js via a CDN, using this feature allows you to customize Bootstrap to the\nstyle guide of your project, as well as define custom styling in a cleaner and more maintainable way (compared to plain\nCSS). The Bootstrap part of this integration could be swapped out for any other frontend styling framework that also\nuses Sass, but there really is no reason to write vanilla CSS.\n\nIn local development, you can simply write scss files and include them using `sass_tags` and your stylesheets should\nautomatically recompile in reload. This also works seamlessly with `collectstatic` for deploys.\n\nNote: If you aren't already using npm to install bootstrap, you can alternatively clone the contents of Bootstrap's sass\nfiles directly into your static directory and change your references to point there. There is currently no good way to\ninstall Bootstrap source code using just python.\n\n### Production notes\n\nIn development, `.scss` files are compiled on the fly. However, when deploying, these files must be manually generated\nusing `python manage.py compilescss`. Also note that if your styles folder is in a directory that's collected with\n`collectstatic`, you should add the `--ignore *.scss` flag to avoid exposing the raw `.scss` files as staticfiles.\n\n\n## Security settings (`security_settings`)\nThese are the recommended security settings. [Explanations for all Django settings can be found here](https://docs.djangoproject.com/en/3.2/ref/settings/). Please pay particular note to what are appropriate cookie and subdomain settings for your application.\n\n## Sentry integration (`sentry`)\n\n\n## User Action Tracking (`user_action_tracking`)\n\nThis feature tracks all URLs accessed by users (along with the status code and user agent) in a table called `UserAction`.\nThis can be useful for debugging, for analytics, or for auditing.  There is a setting `USER_TRACKING_EXEMPT_ROUTES` where\nyou can add the names of routes that should be excluded from action tracking because they would not be useful\n(for example, if your site has a keep_alive route that the frontend regulalry hits automatically).  Note that only\nactions by authenticated users are tracked.\n\n# Optional Settings\n\n`MAINTENANCE_MODE`: Set this flag on a server environment to stop all user requests to the site, such as when you need to make substantial server updates or run a complex database migration.\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzagaran%2Fdjango-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzagaran%2Fdjango-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzagaran%2Fdjango-template/lists"}