I am unable to run python script inside my django project.
- I have create a directory with
mkdir scripts - Then I use
touch scripts/__init__.py - Then I create my python script using
touch scripts/update_keyword.py - here is the code of my script
def run():
# Fetch all questions
print("run script")
Then I run my script with the help of the following command:
python manage.py runscript update_keyword.py
Now I am getting following error:
Unknown command: 'runscript'
Type 'manage.py help' for usage.
I have follow this blog https://django-extensions.readthedocs.io/en/latest/runscript.html . Kindly Help.
2 Answers 2
Django does not know this command since it is not listed anywhere. When you want to run a command with manage.py, use Django's Admin Command.
EDIT Or if you really want to use django_extensions for some reason, use their GitHub docs as reference. There it states you need to add this app to INSTALLED_APPS:
INSTALLED_APPS = (
...
'django_extensions',
...
)
1 Comment
pip install django-extensions to install django-extention.Check the installation:
https://django-extensions.readthedocs.io/en/latest/installation_instructions.html
I guess you have missed this:
INSTALLED_APPS = (
...
'django_extensions',
)
Comments
Explore related questions
See similar questions with these tags.
django_extensionsin installed apps ??django-extensionsso you should make sure you follow the installation instructions