Skip to content

Commit 019d273

Browse files
authored
Added admin.py to root in new app, and added app dir to tests (#892)
added admin.py to root in new app, and added app dir to tests
1 parent 81f7c7e commit 019d273

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

scripts/app.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ def create_app():
2020
os.makedirs(app_path, exist_ok=True)
2121

2222
# Create the app's directories
23-
init_dir(app_path, "admin")
2423
init_dir(app_path, "factories")
2524
init_dir(app_path, "filters")
2625
init_dir(app_path, "migrations")
@@ -31,8 +30,19 @@ def create_app():
3130
init_dir(app_path, "views")
3231
init_dir(app_path, "serializers")
3332

33+
# create tests directory
34+
TESTS_PATH = os.path.join(BASE_PATH, "tests")
35+
36+
if app_name in os.listdir(TESTS_PATH):
37+
print(f"App '{app_name}' already exists in 'tests'.")
38+
else:
39+
path = os.path.join(TESTS_PATH, app_name)
40+
os.makedirs(os.path.join(TESTS_PATH, app_name), exist_ok=True)
41+
init_app_file(path, "__init__.py")
42+
3443
# Create the app's files
3544
init_app_file(app_path, "__init__.py")
45+
init_app_file(app_path, "admin.py")
3646

3747
config_content = f"""from django.apps import AppConfig
3848

0 commit comments

Comments
 (0)