Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Error with Django start up


Hello,

I have installed Django template as per process, but when starting server it throw below errors,


```
jigarpatel@MyPC:~/oipython/starterkit$ python3 manage.py runserver
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/home/jigarpatel/.local/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/home/jigarpatel/.local/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
autoreload.raise_last_exception()
File "/home/jigarpatel/.local/lib/python3.10/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception
raise _exception[1]
File "/home/jigarpatel/.local/lib/python3.10/site-packages/django/core/management/__init__.py", line 394, in execute
autoreload.check_errors(django.setup)()
File "/home/jigarpatel/.local/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/home/jigarpatel/.local/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/jigarpatel/.local/lib/python3.10/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/home/jigarpatel/.local/lib/python3.10/site-packages/django/apps/config.py", line 193, in create
import_module(entry)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'whitenoise'
```

What is the reason for this error?


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (10)


Its because this App needs modules that you have not installed yet.
Please just try
pip install whitenoise
or (depends on your Version of pip)
pip3 install whitenoise



Thank you, now server is running, but home page shows errors,


Error during template rendering
In template /home/jigarpatel/oipython/starterkit/_templates/layout/master.html, error at line 14

You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.

4 <head>
5 <title>{% block title %}{% endblock title %} - Keenthemes</title>
6 <meta charset="utf-8"/>
7 <meta name="description" content=""/>
8 <meta name="keywords" content=""/>
9 <meta name="viewport" content="width=device-width, initial-scale=1"/>
10 <meta property="og:locale" content="en_US" />
11 <meta property="og:type" content="article" />
12 <meta property="og:title" content="" />
13 <link rel="canonical" href=""/>
14 <link rel="shortcut icon" href="{% includeFavicon %}"/>



You have to define the STATIC_ROOT. You have to set it in the settings. However, this error indicates that you run your app in production mode.

I don't want to offend you, but I recommend you go through a few Django tutorials, as these errors are very basic and otherwise you'll just work your way from error to error.

For this error i recommend:
https://stackoverflow.com/questions/36760549/python-django-youre-using-the-staticfiles-app-without-having-set-the-static-ro



Hi,

I'm glad to hear that the server is now running. Regarding the error on the home page, it seems to be related to the `STATIC_ROOT` setting. To address this issue, please try removing the following lines from the `keenthemes/settings.py` file:

whitenoise.middleware.WhiteNoiseMiddleware
whitenoise.runserver_nostatic

After removing these lines, the issue should be resolved. We appreciate your patience, and we'll make sure to fix this on our side as well.

A big thank you to Johannes Kanthak for providing assistance!

If you encounter any further issues or have additional questions, feel free to let us know.



Even after removing these lines in settings.py, it shows same errors.



Have you tried to restart your console? And restart the command "python manage.py runserver"

Thanks



Yes, it has been done,



Could you please try to redownload from here?

https://devs.keenthemes.com/metronic/django



Thank you Faizal, With Dev version all worked fine.



You're welcome! glad that everything is working fine with the Dev version. If you have any more questions or need assistance in the future, feel free to reach out.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(