I've been trying to add in a functionality to my already existing Django application.
Currently, my application only services multiple users belonging to an organization.
I'm trying to accomplish a task wherein:
Multiple organizations can work with my application by having separate databases. This way organization-specific data is private to individual organizations.
For every organization that wants to subscribe to the web app services, the web app shall use a database template to create the database for the new organization and commission it.
The web app should handle/service all organizations simultaneously.
Is this possible?
Related
I have a django project that is hosted internally, and this project feeds the database. I need an API that serves the data of that database to a public domain (that api does not do any DML only selects), but this API needs be hosted in a diferent machine and even if the project that is hosted internally explodes that api needs to keep working.
I am using DRF for the api
I did an api project that has its own apps, views, serializers and models(those models connect to the db existing table like this) and only have the fields that I need represented. Is this the right way to do this or am I missing something? The thing that I am worried is if one of the columns of a model changes name i will have to change the model in the api, but that is a very rare modification.
I don't know if I understood the question correctly but it seems from your question that you have a DJANGO project along with the DATABASE hosted on a particular machine. If that is the case then if your server goes down external API's will not be able to fetch your data.
If on the other hand you have a dedicated server or RDBMS for only your database then you will be able to fetch the data using any API connecting to that database server.
(Disclaimer : I'm just getting started with Django, and with web dev in general)
I have a backend app that stores different kinds of resources. Some are public and some are private. The application is accessible only to identified users. A GraphQL API allows me to access the resources.
On another server, I'd like to create a website that will be accessible to everyone. I want to use Django to create it.
The website will display a list of resources tagged as "public" in the backend app, with a pagination system and, say, 20 resources by page. The CSS will differ from the backend app and there will be a search section.
From what I understand, I should be able to retrieve the data through the GraphQL API, but I'm a bit confused here. All the documentation and tutos I can find about Django and GraphQL seem to be about setting up a GraphQL API server with Django. All I want to do is to build custom queries and to display them on my different html pages.
How can I do that? Where should I start?
You should connect your project with a GraphQL client. As per my research, I have found that there are implementations and examples for graphene-mongoengine in Flask (Flask has a direct GraphQL client).
Mongoengine Flask with GraphQL Tutorial
For Django you can check this out
Edit- I was able to get the data from my database with python-graphql-client. Now I am able to display them in my template.
Let me know if this helps
I'm creating a Django project which involves the use of a REST framework (using DRF) in one app, and a web-based interface in another app. The REST framework uses the default session engine, which I believe is through database storage, in order to track user metrics more accurately. However, in the web-based interface, I want to use the cookies engine to provide simple authentication services.
Is there any way I could use two different session engines in two different Django apps, under one project?
I bind a postgresql service for two apps. They both update the database. Problem is that I use one of the app to create the tables(database schema) by using spring jdbc namespace. But since the other one is provisioned to use a different user name and password. It can not access the tables created by another one. Anyway cloudfoundry to provide the flexibility to resolve the issue?
For Spring apps, this can be achieved by taking the advantage of "auto-reconfigure". CF detects the bean of class javax.sql.DataSource under certain conditions and then replace the properties such as username or password with values of provisioned ones. You can find very detailed instructions here: http://docs.cloudfoundry.com/frameworks/java/spring/spring.html
Therefore for your 2 apps you can both configure the datasource connection as the same format. As long as you bind the same postgresql service to these 2 apps, although CF will inject different values to both apps, they can access same table without any explicit configurations.
I want to try make a web service where the users can post data into a database, and it also should support data posts by some system that is not used my some user. In the end it should have some type of webAPI to allow other users to make other kind of web services using whatever data it contains in the database.
But my main question is does Django have some type of shell interaction function that I can use to let embedded system to login, then to talk to my web service and post data?
You can build a REST API using one of the packages listed here:
http://www.djangopackages.com/grids/g/api/