How would you set up a custom command in Django that can be run using the manage.py file?
- a. Create a Python script with your command logic, save it in the Django project directory, and add an entry in the commands list in the project's __init__.py.
- b. Create a Python script with your command logic and place it in the management/commands directory of your Django app.
- c. Modify the Django source code to add your custom command.
- d. Use a third-party package for custom commands.
To set up a custom management command in Django, you should create a Python script in the management/commands directory of your app. Django will automatically discover and make it available through manage.py. Options a, c, and d are not standard practices.
Loading...
Related Quiz
- You are assigned a task to implement a decorator that logs the arguments and return value every time a function is called. How would you implement this logging decorator?
- What is the time complexity of accessing an element in a Python list by index?
- How can you view the list of variables and their values in the current scope while debugging with Pdb?
- Which Python framework allows you to integrate Python back-end code with HTML, CSS, and JavaScript for web development?
- In Django, what is the role of a "view"?