# Clarifications about how to integrate Spirit in an existent project ?

F
Frederic
Frédéric Bentz
• 1
• 22 Jul '20

Hi,
I read the installation steps, but this is unclear, you say absolutely nothing about how to integrate Spirit in an existent project. While this is certainly the most frequent case.

1 - Install Spirit -> OK
2 - Start your site -> This is the first problem, my site is already started...
Should I run the command spirit startproject mysite and if so, where ? from the root folder ?
3 - Set up the database -> Is this compatible whit the django model already in place ?
4- Create an administrator account: This was already done for the Project itself. Should I do something more ?

I would greatly appreciate detailed explanations for all of this steps to avoid some unwelcome surprises.
Thx

nitely
Esteban C Borsani
• 5
• 22 Jul '20

[...] integrate Spirit in an existent project [...] is certainly the most frequent case.

Not really, but ok.

2 - Start your site -> This is the first problem, my site is already started...
Should I run the command spirit startproject mysite and if so, where ? from the root folder ?

You should start a new project, then add all the spirit settings and urls into your existing project. There are no docs for this because settings change and I don't like updating docs.

3 - Set up the database -> Is this compatible whit the django model already in place ?

Once spirit is installed, and step 2 is done, run the spiritinstall command in your existing project (which runs django migrations and collect static assets). Spirit uses all Django built-in contrib apps, and it expects the standard models, for example if you have done weird things like overriding the user model or used your own user model then it won't work, but otherwise it will work just fine.

4- Create an administrator account: This was already done for the Project itself. Should I do something more ?

No, a superuser is all you need. The migrations take care of creating the Spirit profiles.

nitely
Esteban C Borsani
• 22 Jul '20

There is one last thing, Spirit usernames are case-insensitive by default. If you existing site has many users, you may want to disable this, otherwise the migrations will fail if there are clashing usernames. You will get an error message explaining this. To make usernames case-sensitive set ST_CASE_INSENSITIVE_USERNAMES setting to False.

Also, you may want to use your own auth app (login, register, etc), that should be fine. Spirit will use whatever the LOGIN_URL is.

O
ojophilip
Ojo Philip Odeniyi
• 29 Jul '20

Thanks for prompt responses. Your reply about adding spirit settings into existing project is not well understood by me. My concern is about the setting that came with the project, will that be deleted? Also , can the spirit settings be merged into a single file

nitely
Esteban C Borsani
• 29 Jul '20

will that be deleted?

No. You'd open both Spirit (base.py) and your project settings files in a text editor (VSCode, Pycharm, etc) and manually copy/paste the spirit settings into your project. For example you'd add all django.contrib apps, spirit.core, spirit.admin, etc to your project INSTALLED_APPS; same with every other setting in there. Basically, merge both settings files into one.

You need to do this with urls.py as well.

base.py is your regular Django settings.py file. It's called "base" because I prefer it that way. I use several environments and settings (tests, dev, and prod), and import base from those, that way I can easily pick whatever setting I want to use without duplicating all settings in every file.

O
ojophilip
Ojo Philip Odeniyi
• 30 Jul '20

Thanks very much, I will give it a try

O
ojophilip
Ojo Philip Odeniyi
• 30 Jul '20

I got the following error when I ran spiritinstall command.

ModileNotFoundError: no module name debug_toolbar.

How do I solve this issue. Thanks

O
ojophilip
Ojo Philip Odeniyi
• 3
• 30 Jul '20

Thanks I've solved it by removing debug_toolbar from installed apps

A
• 5 Aug '20

I second that it would be nice to have a page that lists some basic instructions on how to get it up and running as an app in an existing django site. There are lots of high quality, 100% open source "forum in a box" apps out there (discourse, etc.) so it would seem that spirit could occupy the 'would rather just have one deployment' niche for django sites... Maybe a .md file that you only accept PRs for and never have to update yourself? A page on the Github wiki?

nitely
Esteban C Borsani
• 15 Aug '20

@AntonOfTheWoods, that's a good idea. I think the docs would be a good place for such guide. Feel free to write it and PR it.

1819009's comment was removed 10 months, 2 weeks ago
1819009's comment was removed 10 months, 2 weeks ago
1819009's comment was removed 10 months, 2 weeks ago
nitely
Esteban C Borsani
• 23 Sep '20

@1819009, There is a category named "Test posting", go post there.