Which is the correct place of the forum code?

M

Hello! Thank you very much for this forum. I've managed to install it to my website and integrated it with common authentication system.

Now I'd like to adjust the appearance of the forum to the common design. From what I see, the main code of the package is located in the virtual environment of my project, together with all templates. Is it the forum intended behavior, or I did something wrong way? I'd prefer to have the project code inside of an application directory of my main project. Is there a proper way of doing it?

nitely
Esteban C Borsani

I'd prefer to have the project code inside of an application directory of my main project.

You could do that, but why? it's easier to just install it with pip, and then you can upgrade it whenever there is a new version. If you want to override the templates you can do it the django way. You create a template that matches whatever Spirit template path for the template you want to override. The base template can be extended in some sections, but if that's not enough you could override the template (copy Spirit template and modify it). See https://spirit.readthedocs.io…

M
  • 23 Jun

Thank you very much, Esteban! Your suggestion works very well! I've successfully managed to adjust forum templates to my site design. However, now I've met another problem. When I try to create a post to the forum, I've got internal server error (500), which is related to the cache storage 'st_rate_limit'.

File "/home/mike/veterinarian-env/lib/python3.10/site-packages/spirit/core/utils/ratelimit/ratelimit.py", line 130, in incr
return [self._incr(k) for k in self.cache_keys]
File "/home/mike/veterinarian-env/lib/python3.10/site-packages/spirit/core/utils/ratelimit/ratelimit.py", line 130, in <listcomp>
return [self._incr(k) for k in self.cache_keys]
File "/home/mike/veterinarian-env/lib/python3.10/site-packages/spirit/core/utils/ratelimit/ratelimit.py", line 117, in _incr
cache = caches[settings.ST_RATELIMIT_CACHE]
File "/home/mike/veterinarian-env/lib/python3.10/site-packages/django/utils/connection.py", line 61, in getitem
raise self.exception_class(f"The connection '{alias}' doesn't exist.")
django.core.cache.backends.base.InvalidCacheBackendError: The connection 'st_rate_limit' doesn't exist.

In my base.py settings there are following rows:
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'spirit_cache',
},
'st_rate_limit': {
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'spirit_rl_cache',
'TIMEOUT': None
}
}

I'd be grateful if you can suggest what can be the problem (and its solution, of course)!

nitely
Esteban C Borsani
  • 23 Jun

Set ST_RATELIMIT_ENABLE = False and restart the django server to the settings are reloaded.

If that works, then make sure you are not overriding the CACHE setting somewhere in your settings. If you get the same error, then you are using a different settings file.

M
  • 25 Jun

Thank you very much, it works!