Skip to content

Commit 9947917

Browse files
committed
PYTHON-4814 Create project and app templates
1 parent fba8892 commit 9947917

File tree

15 files changed

+246
-0
lines changed

15 files changed

+246
-0
lines changed

app_template/__init__.py-tpl

Whitespace-only changes.

app_template/admin.py-tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.

app_template/apps.py-tpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from django.apps import AppConfig
2+
3+
4+
class {{ camel_case_app_name }}Config(AppConfig):
5+
default_auto_field = 'django_mongodb.fields.ObjectIdAutoField'
6+
name = '{{ app_name }}'

app_template/migrations/__init__.py-tpl

Whitespace-only changes.

app_template/models.py-tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.db import models
2+
3+
# Create your models here.

app_template/tests.py-tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.test import TestCase
2+
3+
# Create your tests here.

app_template/views.py-tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.shortcuts import render
2+
3+
# Create your views here.

project_template/manage.py-tpl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python
2+
"""Django's command-line utility for administrative tasks."""
3+
import os
4+
import sys
5+
6+
7+
def main():
8+
"""Run administrative tasks."""
9+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', '{{ project_name }}.settings')
10+
try:
11+
from django.core.management import execute_from_command_line
12+
except ImportError as exc:
13+
raise ImportError(
14+
"Couldn't import Django. Are you sure it's installed and "
15+
"available on your PYTHONPATH environment variable? Did you "
16+
"forget to activate a virtual environment?"
17+
) from exc
18+
execute_from_command_line(sys.argv)
19+
20+
21+
if __name__ == '__main__':
22+
main()

project_template/project_name/__init__.py-tpl

Whitespace-only changes.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from django.contrib.admin.apps import AdminConfig
2+
from django.contrib.auth.apps import AuthConfig
3+
from django.contrib.contenttypes.apps import ContentTypesConfig
4+
5+
6+
class MongoAdminConfig(AdminConfig):
7+
default_auto_field = "django_mongodb.fields.ObjectIdAutoField"
8+
9+
10+
class MongoAuthConfig(AuthConfig):
11+
default_auto_field = "django_mongodb.fields.ObjectIdAutoField"
12+
13+
14+
class MongoContentTypesConfig(ContentTypesConfig):
15+
default_auto_field = "django_mongodb.fields.ObjectIdAutoField"

0 commit comments

Comments
 (0)