Hosting HTML+CSS+JS websites with Django rest framework backend - django

My backend APIs are hosted on Django rest framework and the for the frontend I have purchased a theme which is on HTML, CSS, Bootstrap, and Javascript, I wanted to know what would be the best practice to host this website in production, should I have two servers one for handling the static website and other for the backend or shall I integrate this with the backend. The theme is quite vast and would like to go with the first option, so I go with the first option then where should I host the website, and does it impact the performance?
I have already researched but could not find what would be the best practice in this situation, Let me know if any other details are required.

If you're use API and frontend template, you don't necessarily need to host them on separate servers. You can do that on one server. It's just a matter of API calls

Related

Vue/Laravel: Hosting on AWS

Learning AWS and looking for guidance on how to best put this app onto the web.
I have a fairly straightforward app:
Frontend build in Vue
Backend built in Laravel
In hindsight, I wish I'd just used Inertia within the Laravel app but alas.
Authentication is via JWT and users are stored within the backends connected database.
What I've already tried:
Attempt One
Using Elastic Beanstalk for Laravel hosting
Amplify for the frontend hosting
The issue I faced was EB uses http where as Amplify uses https so I couldn't get the two parts to talk to each other.
I then tried to use Router53 to make the connection (by buying a domain) but couldn't get the connection to work.
Attempt Two
I tried to put everything on an EC2 instance. Unfortunately, that was way too involved and my skillset isn't yet strong enough to progress there. I don't even know if it's even possible.
Conclusion
Anyone can provide direction on how to best host this app? Its just a practice app and I'm just learning.
Thank you for your help!!

Can Django be used to combine both webapp and moblie api?

I want to use django framework to write a web site with static/dynamic pages (I will not be using angular/react - i.e. SPA technology) but I also want the web app to serve as the backend for a mobile app.
What's the best practice here? Can Django alone be used for it?
Will I need to use Django REST framework?
If you could recommend some specific modules to keep the app as simple as possible and avoid DRY code. That'd be great.
Thanks.
You have the right pointers in your question already.
Use django-rest-framework to create a rest service, create your web app in django to consume that service, create a mobile app to consume the same rest service.
In general, once you have a rest service, you can build anything on top of it. Just consume the service from whichever platform you want to build for.
I hope that helps.

Integrating Django and openui5

I want to use openui5 with django applications. There is no information about it. It's unclear how to use ui5 routing with django urls.py. Perhaps someone has to experience this?
You are confusing front-end routing with back-end routing.
OpenUI5 applications are designed to be single-page applications, so what you have to do is basically load the whole app in your index route and create other routes to expose the data from django, assuming you want to follow the REST architecture.

Communication between Django applications hosted in different servers

I have a Django project hosted in a server and it wants to interact with another django application hosted in another server. How do I go about doing this?
It really depends on what exactly you want to communicate. But irrespective of specific technology, RESTful API is one of the best practices when it comes to communication between applications.
There are numerous apps developed to help RESTful implementation in Django. You can try RestifyDjango or Django REST framework

Django and Drupal

Since Django is a web development framework and Drupal is a CMS.
Is it possible to use them both together instead of a preferred database on Django like apache?
Maybe that question isn't clear enough.
Is it possible to use Django and Drupal simultaneously on the server side to provide a better web development solution?
You can use Drupal and Django side-by-side on the same server for different portions of your web site, but they will be entirely separate systems. They cannot interact in any meaningful fashion (except possibly a Django app making web API calls to Drupal, if Drupal has a web API).
Django is a Python-based web development framework. Drupal is a CMS (and framework, through its module system) written in PHP. They really can't use each other.
Communication between Drupal and any other system is possible and very common, especially using their Services module, and by calling other SOAP (and other) web services.
You can, if you want, to make both Django and Drupal work on the same server, and to call "localhost" for the services you are using, both ways. For Drupal, it is irrelevant where the actual server sits.
If you have a certain Django application you want to integrate with Drupal just write down what it is, and accordingly you will be able to get more help...
Regards,
Shushu