django-project-structure/docs/search/search_index.json

2 lines
11 KiB
JSON
Raw Normal View History

{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Home","text":""},{"location":"#django-project-structure","title":"Django Project Structure","text":"<p>This is a template/project structure for developing django-based applications - using <code>django-rest-framework</code> along with <code>django</code>.</p> <p>The project is meant to be easily clone-able, and used as the starter template for the next big thing you develop. Note, this is a folder structure only, not \u201cbest practices\u201d.</p>"},{"location":"#some-batteries-included","title":"Some batteries included:","text":"<ul> <li>Django Storages - To integrate with different types of storages</li> <li>Django Rest Framework - For API development</li> <li>Django CORS Headers - To allow requests from other origins</li> <li>Sentry - For crashes</li> <li>Gunicorn - As a web server</li> </ul>"},{"location":"#getting-started","title":"Getting Started","text":"<ol> <li>Since this is a template repository, simply hit \"Use this template\" on GitHub and follow the instructions. Otherwise, you can just clone the repo, remove/add anything you see fit.</li> <li>Run the project using <code>python manage.py runserver</code> and you should see the default success page provided by Django at http://127.0.0.1:8000/.</li> <li>[Optional] If you want to configure database, in the <code>DATABASE</code> section of <code>settings.py</code> we have added <code>postgresql</code> as the default <code>DATABASE</code> (As most of the application are using it). You can roll back to the <code>sqlite</code> by adding the following code snippet, removing the current one.</li> </ol> <pre><code>DATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3',\n 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),\n }\n}\n</code></pre>"},{"location":"#creating-an-app","title":"Creating an App","text":"<ol> <li>Create a folder with the app name in <code>apps</code>. For example: <code>poll</code></li> <li>Run <code>python manage.py startapp poll apps/poll</code> from the root directory of the project</li> </ol>"},{"location":"#project-tree","title":"Project Tree","text":"<pre><code>.\n\u251c\u2500\u2500 apps/\n\u2502 \u2514\u2500\u2500 example/ # A django rest app\n\u2502 \u251c\u2500\u2500 api/\n\u2502 \u2502 \u251c\u2500\u2500 v1/ # Only the \"presentation\" layer exists here.\n\u2502 \u2502 \u2502 \u251c\u2500\u2500 __init__.py\n\u2502 \u2502 \u2502 \u251c\u2500\u2500 serializers.py\n\u2502 \u2502 \u2502 \u251c\u2500\u2500 urls.py\n\u2502 \u2502 \u2502 \u2514\u2500\u2500 views.py\n\u2502 \u2502 \u251c\u2500\u2500 v2 # Only the \"presentation\" layer exists here.\n\u2502 \u2502 \u2502 \u251c\u2500\u2500 __init__.py\n\u2502 \u2502 \u2502 \u251c\u2500\u2500 serializers.py\n\u2502 \u2502 \u2502 \u251c\u2500\u2500 urls.py\n\u2502 \u2502 \u2502 \u2514\u2500\u2500 views.py\n\u2502 \u2502 \u2514\u2500\u2500 __init__.py\n\u2502 \u251c\u2500\u2500 fixtures/ # Constant \"seeders\" to populate your database\n\u2502 \u251c\u2500\u2500 management/\n\u2502 \u2502 \u251c\u2500\u2500 commands/ # Try and write some database seeders here\n\u2502 \u2502 \u2502 \u2514\u2500\u2500 command.py\n\u2502 \u2502 \u2514\u2500\u2500 __init__.py\n\u2502 \u251c\u2500\u2500 migrations/\n\u2502 \u2502 \u2514\u2500\u2500 __init__.py\n\u2502 \u251c\u2500\u2500 templates/ # App-specific templates go here\n\u2502 \u251c\u2500\u2500 tests/ # All your integration and unit tests for an app go here.\n\u2502 \u251c\u2500\u2500 __init__.py\n\u2502 \u251c\u2500\u2500 admin.py\n\u2502 \u251c\u2500\u2500 apps.py\n\u2502 \u251c\u2500\u2500 models.py\n\u2502 \u251c\u2500\u2500 services.py # Your business logic and data abstractions go here.\n\u250