Forums

Adding Django Template Gradient?

Hi,

I had an existing project that was running fine. I have since blew out the entire project and started a new one. After I deploy and try to get to the webpage I get a something went wrong error. Here is what my log is pointing to:

022-01-07 17:15:06,292: Error running WSGI application
2022-01-07 17:15:06,302: ModuleNotFoundError: No module named 'core'
2022-01-07 17:15:06,302:   File "/var/www/www_total-scores_com_wsgi.py", line 16, in <module>
2022-01-07 17:15:06,302:     application = get_wsgi_application()
2022-01-07 17:15:06,302: 
2022-01-07 17:15:06,302:   File "/home/jbarth200/priv-django-dashboard-gradient-pro-master/env/lib/python3.9/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2022-01-07 17:15:06,302:     django.setup(set_prefix=False)
2022-01-07 17:15:06,303: 
2022-01-07 17:15:06,303:   File "/home/jbarth200/priv-django-dashboard-gradient-pro-master/env/lib/python3.9/site-packages/django/__init__.py", line 19, in setup
2022-01-07 17:15:06,303:     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2022-01-07 17:15:06,303: 
2022-01-07 17:15:06,303:   File "/home/jbarth200/priv-django-dashboard-gradient-pro-master/env/lib/python3.9/site-packages/django/conf/__init__.py", line 82, in __getattr__
2022-01-07 17:15:06,303:     self._setup(name)
2022-01-07 17:15:06,303: 
2022-01-07 17:15:06,303:   File "/home/jbarth200/priv-django-dashboard-gradient-pro-master/env/lib/python3.9/site-packages/django/conf/__init__.py", line 69, in _setup
2022-01-07 17:15:06,303:     self._wrapped = Settings(settings_module)
2022-01-07 17:15:06,303: 
2022-01-07 17:15:06,304:   File "/home/jbarth200/priv-django-dashboard-gradient-pro-master/env/lib/python3.9/site-packages/django/conf/__init__.py", line 170, in __init__
2022-01-07 17:15:06,304:     mod = importlib.import_module(self.SETTINGS_MODULE)
2022-01-07 17:15:06,304: ***************************************************"

Blockquote

I see it is an error from my code WSGI config file, do I need to go into that file and change the location of my django project now that it has changed from what it previously was?

[edit by admin: formatting]

I believe I found where I need to change it

+++++++++++ DJANGO +++++++++++

To use your own django app use code like this: import os import sys

assuming your django settings file is at '/home/jbarth200/mysite/mysite/settings.py'

and your manage.py is is at '/home/jbarth200/mysite/manage.py'

path = '/home/jbarth200/priv-django-dashboard-gradient-pro-master'

if path not in sys.path:

sys.path.append(path)

But now my question is, my settings file and my manage file are both NOT where it is assuming, how can I declare the new path for those?

It looks like your site is running now -- did you manage to solve the problem?

The answer to your last question is that the path should be the full path of the directory where your manage.py file is, and the foo in the line that looks like this:

os.environ['DJANGO_SETTINGS_MODULE'] = 'foo.settings'

...should be the name of the subdirectory of the path directory that contains your settings.py

Thank you Giles. Appreciate the confirmation.

So the site is up but I'm still having some issues but I have a GIT issue currently open with Gradient.

There seems to be some issues when migrating the site, there are some auth tables that are created, but it appears when I try to access the site I am getting an error saying those tables are no where to be found.

So still quite confused!

Really unsure if it's on the projects end or if it could be something on here or not.

Are you using SQLite? One common problem with that is that if it cannot find the database, it will create a new empty one so you get confusing errors like that. In turn, the most common cause of it not finding the database is if you specify the database as a relative path -- that is, just something like "my.db". That means that when you run your migrations by using cd to set the working directory to the directory containing manage.py, and then run the migrate management command, the correct file will be picked up. But in your running website, where the working directory might be different, it will not.

The best solution is to specify the path to the database using Django's BASE_DIR variable, which it sets in the default settings.py -- something like this:

'NAME': os.path.join(BASE_DIR, 'my.db'),