Maintain a subset of Django app along with full app - django

I'm working on a Django project for a large organization, and the full app will be for internal, private use, while a subset of the view functions and templates will also need to be available publicly. Due to IT constraints, the public portion will be on a different server, and won't be able to use the same files (but it will be able to query the database on the private server).
Is there a way to maintain a subset of the app's files on a separate server?
For example, if the private version has view functions a, b, and c, the public version will only use c. And the public version will only need the relevant template files, etc.
Does Django have some way of accomplishing this? Or Git, somehow (maybe gitignore)? I'm just trying to save myself from having to manually copy all updates from the full version to the partial version.

This is the type of thing that Django's app structure is for. You could make the shared functionality a standalone pluggable app, managed as its own git repository. The projects that depend on it can include it in their requirements.txt and settings files. When you update the shared functionality, you increment the project version, and then update the requirements files.

Related

How to override river-admin template?

Firstly , i would like to say that this package is amazing in the sense where there can be so much flexibility. Im relatively new to this package and im just trying to figure a way to fiddle around with the provided front end in the river-admin package. Could someone point me in the correct direction in doing so?
I am the author of both django-river and river-admin.
river-admin is an admin interface for django-river implemented as a Vue.js application backed by django-rest-framework.
One fact about it is that it was never meant to use the river-admin as an extension to your django app which means that it doesn't have to fit in how your own django app looks. You might think of it is like the UI of Apache Airflow or RabbitMQ admin interface and so on.
But if you think that the things you wanna add are something that can be used by all of its other users why not contribute to the repo. Otherwise, you can always fork the repo and do the custom changes that you can not do via the river-admin API, build the package by yourself.
Here is some information on how one can build and run stuff locally

Different IPs are for different apps

At first, I am learning Python and Django only... So I'm a noobie yet.
I need to build a microservice architecture to I could run each my service on a separate server machine. In the Django I need to create an environment, project and apps. So, can I run these apps after on different servers? If no, how can I make it with Django? Do I need to create a separate project for each service?
P.S. If my question is stupid, pls, explain where am I wrong. I am from Java Spring world where I was need to create just new app for each service.
Either approach will work.
If it makes sense for your services to share the same code base, you can create a single project and use separate apps for each service and separate settings files for each deployment. The settings file would activate the desired app by listing it in INSTALLED_APPS, and would include settings specific to that service.
Or, if you don't need the services to be coupled in that way, you could certainly make each one its own project.

Symfony 3: How to create a private bundle

I have a private API and I am using GuzzleHttp bundle to make calls to it. Now I'm just creating a sub-folder in the src/MyCompany/ApiBundle/.. and I register it in the AppKernel.php and use it without errors.
Now I need to make this a separate bundle (in its own private repository) so I can use it inside different projects.. I followed many tutorials but always face problems as they are for Symfony 2.
Symfony has a tutorial (Generating a New Bundle Skeleton) on the docs but it doesn't talk about external bundles like in my case.
So how to create such bundle? be able to test it and make it in its own repository to be later integrated inside other projects using composer?
Your bundle should be separate project. Check some fos bundles
Also check Best Practices for Reusable Bundles
You may also like to check
Using private repositories with composer
Handling private packages with Satis or Toran Proxy

Share NodeJS Apps like Django

I come from a Django background, where to add functionality to the site you make an app. You can share that app between other Django projects.
In the Node world I haven't really seen anything like this. However, I want to write code that is reusable and useful to the community. So I'm wondering:
Do Node programmers share apps?
How would I structure an app so that it would be easy for someone to add to their site?
Node.js developers share functional packages of code called modules through the npm registry. The modules are used the same way as the modules shown in the documentation, and are typically utilized with require(). However, do take note that Django is a web framework, and Node is a programming language. Node is to Python as something like Express would be to Django.
There isn't any specific way to structure a Node module. You just need to make sure that the package.json file is configured correctly so that the module can download any dependencies, set any binaries, and do general setup correctly.

What is a Django "app" supposed to mean?

I'm new to Django and trying to understand the preferred means of operation when deploying web applications.
Let's say I'm making a web application with (for example) user login management, some uploading functionality, manipulation of uploaded files, and rendering uploaded files on screen. They're all part of the same "web application".
Would each of these functions be its own app in the project, or should these all be together a single app? Is a Django app intended to correspond to a web application, or does it correspond to a single set of functions interfacing with a few tables in the database?
There's a distinction to be made between reusable apps and non-reusable apps. For reusable apps it's essential that they offer well defined functionality and are intended to solve a well defined problem. If this wasn't the case, they wouldn't be very reusable.
However you're likely to also have some non-reusable apps, i.e. one or more apps in a project that implement application logic that's specific to the project. In my projects I always have a non-reusable app called core that acts as glue and ties everything together. If I have distinct sections in my site I may choose to have more non-reusable apps, because I like the way it essentially namespaces my project (e.g. models, views, templates, etc.)
A Django app is a group of related functionality used to complete or maintain one aspect of a site. The web application you describe would be separated into at least 2 Django apps, depending on how granular you want to make the handling of the uploaded files.