django-suit icon indicating copy to clipboard operation
django-suit copied to clipboard

Basic install / config documentation for v2?

Open Bartvds opened this issue 8 years ago • 6 comments

After a year of eyeballing the #475 I tried installing the v2 preview, and I have the basics on screen but it is a bit of a mystery how I can get a custom menu and other config stuff to activate.

The docs are still placeholder: http://django-suit.readthedocs.io/en/v2/install.html

Looking at the demo app there is something going on with an extended app config, and there are some little bits of info of unclear status in #475.

So I tried all kinds of combinations of things I see in the thread and in the source of the demo app but so far no customized menu or settings.

We got a custom admin site, very basic just so we can tune a few things. But I can't figure out how we can get this custom admin site to use the extended DjangoSuitConfig, and why app/label I need to set in our extended config. Maybe I just miss something obvious?

Maybe this needs a few lines of documentation so we can get started and test this? I there some other ticket that has this?

Bartvds avatar Mar 01 '17 13:03 Bartvds

There is no docs yet, I wanted to finish all the features first and that is the reason why I included full source of demo app and make a references to it for every new feature: Demo: http://v2.djangosuit.com/admin/ Code: https://github.com/darklow/django-suit/tree/v2/demo Suit config: https://github.com/darklow/django-suit/blob/v2/demo/demo/apps.py Adding suit: https://github.com/darklow/django-suit/blob/v2/demo/demo/settings.py#L39

darklow avatar Mar 01 '17 13:03 darklow

I was more thinking about a simple 'how to get a preview up and get testing while we finish all the features' type of minimal thing. But I think I got it: the confusing thing was figuring out this new app config approach from the demo.

(and this get a mess once we started trying random stuff and wondering how the demo app import the suit app)

If anyone find this: to customize the menu etc we have to put an extended DjangoSuitConfig in our own apps somewhere and add the dotted path to INSTALLED_APPS. We don't add a string 'suit' like before, because the extended app config is still responsible for activating the suit app with Django (for the templates, static files etc). This also means we do NOT set an app label on the extended DjangoSuitConfig, so it is still the 'suit' app.

So yea, demo app has everything if you don't get confused. 😉

Thanks, looking good.

Bartvds avatar Mar 01 '17 13:03 Bartvds

This new kind of app config was introduced in Django 1.7 - https://docs.djangoproject.com/en/1.10/ref/applications/#configuring-applications, I still wonder why adoption of this feature is so slow and so many django apps keep old classic way of having all these messy caps-locked constants right in settings.py.

But you're right, some minimal docs would be good, will look forward to add them.

darklow avatar Mar 01 '17 14:03 darklow

I've seen that documentation page a few times but never really grasped the intention beyond the ready() method and some cosmetics, and this is actually the first external app I see that uses it for the configuration instead of the classic settings. Much cleaner indeed, TIL.

Anyway, django and python are great for cargo-culting tribal knowledge, so stable and backwards compatible 😆

Bartvds avatar Mar 01 '17 16:03 Bartvds

Just to add to @Bartvds explanation.

So my setup looks like:

  • myproject/apps/app1/; myproject/apps/app2/

I created a config.py file containing:

from suit.apps import DjangoSuitConfig

class SuitConfig(DjangoSuitConfig):
    layout = 'horizontal

which I stored in the myproject/apps/ directory, and then added this to my settings file:

INSTALLED_APPS = [
    ...
    'myproject.apps.config.SuitConfig',
    'django.contrib.admin',
]

Hope this might help someone?

gamesbook avatar Apr 09 '17 10:04 gamesbook

So in my case the setup works :

    1. Create an app.py file in project level (where settings.py is located) and add below code:
from suit.apps import DjangoSuitConfig
class SuitConfig(DjangoSuitConfig):
    layout = 'vertical' 
  • 2.In my settings file:
INSTALLED_APPS = [
    'suit', 
    'django.contrib.admin',
    'django.contrib.auth',
     ...
]

Hope this might help someone?

jakariadev avatar Oct 19 '21 09:10 jakariadev