I have made a web-app using django framework and stored it on heroku.
How can i combine phonegap so that I will be able to create both iOS and Android application that will simply load my hosted website?
I'm having an hard time knowing how to combine both technologies (django and phonegap) together, because phonegap requires the "index.html" and i dont know how to make it navigate to my main page.
And i dont know what "Procfile" to use in order that the heroku server will know how to react both.
I have seen somthing involves rest API for django. I found it hard to understand why should i add it for my website...
A tutorial would also be great !!
Integrating phonegap and django is a pretty broad topic covered here and in this tutorial.
For setting up multiple stacks on the same heroku app, you will probably want to use buildpack-multi.
Related
I'm trying to upload my full-stack website, done with Django and React on Netlify.
I have tried various ways and searched for different tutorials, but unfortunately I did not find them useful ...
Many recommend using cactus to launch their own applications consisting of python, but I don't think it can work with Django, does anyone know how to do it or give me some advice? Thanks
note: netlify is only for "static" websites, so how can I make my Django application "static"?
Netlify is not really the match made in heaven for Django, I think you should give Heroku a go, which supports Django out-of-the-box.
If you do want to use Netflify and are ready to resign from the Django's backend features (built-in database, admin panel etc are not going to work after you make a static export), Cactus does work with Django. You could also try django-distill.
I want to use Django Rest Framework as an API and am looking for a way to "couple" the frontend / HTML/CSS/JS to it.
To put it in perspective, I am used to the way Django "usually" does it, by naming HTML templates and 'rendering' them when going to a particular URL.
Now, with DRF, it appears that this functionality has fallen away and everywhere I look it's just "react.js or vue.js" as the answers to consume the API.
What are my options for the front end? Can I not just do it all within the 'usual' Django framework, simply, as it was done before. And why do no resources talk about this?
Thanks, let me know if you require further info.
DRF is just additional layer for Django which help to implement API. You can use Django for render html on server side and serve it to browser. You don't need use DRF for it. But if you assume that you frontend app will be interactive, dynamic and complicated then it is not best way to solve it.
More popular approach suggest to separate it on frontend application (react or vue) and backend with REST API for interact with. It allow move all things related with UI on frontend app and only keep state on server.
By the way Django was developed for generate html on server and for site like this https://www.washingtontimes.com/news/ but world changing. Resources talk just about popular things
Not a web developer, but currently playing with cordova and would like to use django to use python to implement backend functionality. As I (vaguely) understand it, cordova manages frontend stuff and django is mostly for backend stuff. So is it possible to use django as a backend for a cordova project (eg. directly use preexisting django templates in a cordova app)? If so, how? Is there some kind of special communicationn that I'd need to code myself?
(My uneducated guess would be to initialize the django project inside the cordova www folder, but this seems wrong). And if this is a totally wrong way to think about this problem, let me know.
You could use Django as your backend and implement a REST like API (urls that accept and return JSON data) in it. There are useful tools/libraries for that, for example django-rest-framework.
Then you would call those endpoints (URLs) from your frontend, which can be written in cordova or any other JS frontend frameworks.
As you already pointed out, I suggest keeping frontend and backend code in separate folders.
I've built out a basic django application, and I'm looking to incorporate react+redux into the app. I've come across several react+redux templates like the react-redux-starter-kit and redux-webpack-es6-boilerplate:
These are awesome, except they both run node servers. I'm wondering:
Does there exist some sort of a tutorial or template that has the same features (webpack, Hot Module Replacement, linting, testing, abides by Fractal Project Structure guidelines, etc...) but does not run a node server, so I can just copy it into my django application (I realize I'd have to do a fair bit of configuration to get everything working smoothly).
Is it ok to run the webpack server within my django application? (Basically node would be running within django) Are there any downsides in doing this?
I've tried altering the above two templates, but they are pretty dense and complicated. Any advice would be very much appreciated!
I don't see any reason to mixing up django and react app.
I would prever leave them as two independent parts of your application: SPA (react + redux) + API (django)
If you already have django app and just need to add some react pages into, then build react app as static files and place it outside your django project, and configure your reverse proxy server (nginx) to load those new pages as static pages (react).
I have been looking online and there are some articles about people using Django web framework and Phonegap to build mobile applications.
However, it says on phonegap to upload your HTML, JS, and CSS files to the build. Does that mean you cannot use django to build mobile apps with phonegap?
Any clarifications or steps on how to build would be great.
Think of PhoneGap as preloaded static web pages in a WebKit view. You can add JavaScript (most people use JQuery/JQueryMobile) to make it dynamic and use AJAX calls to load data from a server but rendering templates is not what it does. You can do fragments but it's not the same thing as Django Templates.
I am working on a project that handles data loading via an API from a server running Django. The App is being written in PhoneGap and uses AJAX calls for getting the extra data. I'd say look at django apps like TastyPie for helping get data. The main goals in using PhoneGap are 1) better load times of HTML since it's local, 2) Reduced traffic by only sending API data and thus better for cellular networks and 3) access to native feaures in the hardware you don't otherwise get access to with JS in a webpage.