-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
31 lines (23 loc) · 859 Bytes
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
import django
from django.core.management import call_command
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dropship_project.settings")
django.setup()
def setup_project():
print("Setting up the Dropship V2 project...")
# Run migrations
call_command('makemigrations')
call_command('migrate')
# Create superuser
from django.contrib.auth import get_user_model
User = get_user_model()
if not User.objects.filter(username='admin').exists():
User.objects.create_superuser('admin', '[email protected]', 'adminpassword')
print("Superuser created.")
# Populate database with sample data
call_command('populate_db')
# Collect static files
call_command('collectstatic', interactive=False)
print("Setup complete!")
if __name__ == "__main__":
setup_project()