Here is the list of commands commonly used in django projects.
django-admin startproject app #(Create main project)
All following commands are to be run from inside main app folder that we created with the first command.
python manage.py runserver #Run local server python manage.py migrate #Run all database migrations python manage.py makemigration #Create any new migration created file python manage.py startapp <app_name> #Create new application within the main app folder #application created using this command won't be automatically enabled, #but we need to go in app/app/settings.py and need to add our new application name at the end of INSTALLED_APPS list. python manage.py shell #To open interactive Django shell like Tinker for Laravel
Below is a sample code that tell us how we can benefit from interactive shell. Using that we easily created two database entries using Track model of an application’s model.
(react-tracks) python manage.py shell Python 3.7.2 (default, Nov 10 2011, 15:00:00) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> from tracks.models import Track >>> Track.objects.create(title="Track 1", desc="Track 1 description...", url="https://track1.com") <Track: Track object (1)> >>> Track.objects.create(title="Track 2", desc="Track 2 description...", url="https://track2.com") <Track: Track object (2)> >>> exit()