diff --git a/README.md b/README.md index 7e9b983b..c4065f1c 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,6 @@ Everything you do here is contained within this one codespace. There is no repos To run this application: -``` +```python python manage.py runserver ``` diff --git a/hello_world/core/views.py b/hello_world/core/views.py index edb2ee87..b6936cff 100644 --- a/hello_world/core/views.py +++ b/hello_world/core/views.py @@ -1,4 +1,3 @@ -from django.http import HttpRequest from django.shortcuts import render def index(request): diff --git a/manage.py b/manage.py index d76e03f4..4dfa9984 100755 --- a/manage.py +++ b/manage.py @@ -3,18 +3,19 @@ import os import sys +try: + from django.core.management import execute_from_command_line +except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + def main(): """Run administrative tasks.""" os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hello_world.settings") - try: - from django.core.management import execute_from_command_line - except ImportError as exc: - raise ImportError( - "Couldn't import Django. Are you sure it's installed and " - "available on your PYTHONPATH environment variable? Did you " - "forget to activate a virtual environment?" - ) from exc execute_from_command_line(sys.argv)