Django or Python integration (API)

I’m looking into using Nextcloud as a backend for a Django project. Think of it merely as a website or intranet that provides collaboration features (user profiles, user groups, documents, tasks and communication).

In order to provide a uniform user experience I’d like to integrate deeply into Nextcloud, e.g.

  • Users should authenticate with the Django site (django-allauth)
  • User profiles will probably be managed by a Django app (make it easy to extend the profile)
  • User groups may also be managed by the same or another Django app
  • A Documents app may list folders and document owned by the current user or a user group
  • A Todo app may list tasks from Nextcloud’s Tasks app
  • A CMS component (e.g. django CMS plugin) may allow adding references to documents or tasks hosted on Nextcloud

… add more ideas, the sky is the limit.

How Do I Integrate into Nextcloud?

As a first step I’d like to integrate authentication and theming (i.e. the visual appearance of Nextcloud).

  • If a user accesses a resource on Nextcloud they should not need to authenticate again (or authenticate via the Django site if they come from an email link or so).
  • Also, Nextcloud should be themed similar to the Django site (by use of the built-in Nextcloud Theming, e.g. I have a Django app that sets both the wallpaper on the Django site and on Nextcloud).
  • When users or groups are created, and a user profile is updated then the related user profiles and groups on Nextcloud should be created or updated, too.
  • Ideally, we should disable the related functionality on Nextcloud, and instead (optionally) link to the feature implemented in Django. This refers to both the theming and the user profiles/groups.

Can this be done as of today?

Which is the correct API documentation for background reading?

Related Resources

1 Like

Dropping some shameless self advertising: the app store is also written in Django :wink:

I’ve seen that, made me smile. :sunny: Maybe one day we can refactor even Nextcloud and make it based on Django? Shouldn’t be too hard with all the functionality moving to the frontend. JavaScript is a first-class citizen in Django. :slight_smile:

Super not going to happen :smiley:

And if it happens people should use a better language than Python, e.g. Rust :smiley:

Fine. (So why wasn’t the NC app store written in Rust? :dizzy_face:) Every language has its place.

I still have no answer to the API questions, though:

  • Can what is described above be done? Can I do that via the API? Which one? (Are there any integrations that have done that before?)
  • Which is the correct API documentation for background reading? (Developer docs, please!)

I’m willing to write an open source integration, but I need your help.

Fine. (So why wasn’t the NC app store written in Rust? :dizzy_face:) Every language has its place.

exactly, use the right tool for the job ;D

Can what is described above be done? Can I do that via the API? Which one? (Are there any integrations that have done that before?)
Which is the correct API documentation for background reading? (Developer docs, please!)

You can do everything already if you use ldap as backend which is what I’d recommend. Other than that there’s https://docs.nextcloud.com/server/11/admin_manual/configuration_user/user_provisioning_api.html if you want to get your hands dirty :slight_smile:

Everything related to files can be achieved through webdav (and the sharing api https://docs.nextcloud.com/server/11/developer_manual/core/ocs-share-api.html), contacts and calendar are available over carddav. Apps like Tasks probably have an external API which you need to look up by yourself.

1 Like