Is it possible to implement RESTful webservices with Orchard CMS? The way I understand it from reading the documentation is by implementing a new module and rendering the views as json/xml/etc.
What if I wanted to expose all of Orchard's Admin abilities through a web service?
Orchard is MVC. You would do that pretty much exactly the same way as with a regular MVC app. Only difference will be how you define your routes (implement IRouteProvider instead of adding them from global).
I have not done it myself. I have used Orchard CMS and WebApi on separate projects though.
I do recall seeing a blog post explaining how to integrate WebApi with Orchard CMS.
If you are not familiar with WebApi you should check it out.
Here it is: OrchardProject + WebApi = interesting
Related
I'm just wondering since Jquery is used less and less and instead of classic use with Ajax, if it is possible to let for example React or Vue handle all of the functionality where Javascript would be needed with DRF in one hand , and consider all of it as statics.
And in the other hand, keep working with Django and regular templates.
i'm just asking about the possiblity to do so.
Yes. There are many tutorials available for using Django, some with Wagtail as a CMS, with DRF as the backend. You can use a single template, and Vue or ReactJS for the front-end.
Here's a workshop video that might help get you started from the folks at Learn Wagtail: https://www.youtube.com/watch?v=xUWd3o6z2bk
(I chose Wagtail, because it is a popular Django CMS with DRF API endpoints out-of-the box.)
Hello I am tasked with translating a current Excel tool to a web application. I decided to use Python and Django. Lately I studied the Django REST framework. I have the following related questions.
Is it for such an application a good idea to first write a web REST API so that I
firstly only need to focus on the backbone of the web application. I.e. implement the PUT, POST, GET and DELETE methods and the Django models.
The second step would be to implement the user interface... But if this is a valid method how can I reuse the REST views??? I followed the REST tutorials, but they don't show how to build a nice slick user-interface on top of the REST API.
Since REST views inherit from Django, I think it's maybe not such a good idea to write a Django view which inherits from a REST Apiview? Or can I directly use an API endpoint in a template. If so where can I get some nice examples?
Writing the back-end separately using Django REST Framework is a great idea.
There is a strong architecture based on the idea of decoupling the back-end from the front-end. After you finish the project's backbone, as you are calling it, you can start creating you front-end but your don't have to use Django template rendering in that case.
You can take the pros of using REST APIs and you can use one of the good front-end frameworks or libraries as Angular and React.js.
Another advantage of this that the same API can work with mobile development and so on.
So you develop one back-end and multiple front-ends depends on your need.
Also you can read a discussion about your question on Quora: https://www.quora.com/Why-does-it-make-sense-to-separate-front-end-from-back-end
I want to create a webservice in a django project.
What i mean by webservice is a route which will talk with json structures instead of html.
I am wondering if a show put the webservice code in views.py or if i should create a separate file (like api.py ?). It will work on both cases, i juste want to know which is the cleanest way
I hope you want to build a web API for your application.
There are two dominant third party plugins for django
Django Rest Framework. - http://www.django-rest-framework.org/
Tastypi - http://tastypieapi.org/
Both have there pros and cons. Do some research and choose the one that best suites for your need.
Historically I've mainly written web apps in Django, but now I'm increasingly finding that I want to write single-page web apps using Backbone.js or a similar JavaScript framework, with a back-end that solely consists of a database and an API.
My questions is this. If my application structure looks like this:
1. Database
|
v
2. API methods
|
v
3. Single-page front-end written with Backbone
and I'm most comfortable in Django - but also keen to learn new things too, such as NoSQL and Node, if they are appropriate - what would people recommend I use for (2)?
Typically I would use Django with Piston as the API app, but it seems rather heavyweight to have all of Django and only use it as an API provider. Perhaps I shouldn't be worrying, though.
If you use Django, which is an MVC framework, and use Backbone, you might be comfortable setting up your app in pure Node.js or Express.js, with additional modules for connecting to your choice of database.
With Express, if you plan to serve only JSON via RESTful interface, you don't even need to use Views, which is handy. You would only need to set up models and routes (that also serve as controllers).
Any server side framework or lang that is capable of supporting or providing for RESTful APIs should work. I myself as using Slim PHP right now. But seeing that you are from a Django/Python background perhaps this post would be helpful to you.
Recommendations of Python REST (web services) framework?
This question is regarding the co-extisense of two MVC Frameworks (on the client side and the server side).
Some Background: I am fairly new to web development, but am a very proficient programmer. I learnt javascript and Django only recently. The Front end for my app is quite Javascript extensive and hence I decided to use a framework. I am currently reading up on the available frameworks and I am inclining towards backbone.js + jquery.
My problem is that I don't fully understand how a MVC framework like backbone.js can co-exist with a server side framework like Django.
From what I understood of backbone.js, when there is a change to a model, the corresponding views related to the model are automatically updated. Here, we are referring to the "views" of the Client side framework right? Would such a "view" communicate with the backend framework's "controller"?
How would a possible directory structure be? Is such an architecture bad?
Does the question make sense? or am I lost?
Edit: To add some clarity: I guess my essential question is : How a complex single-page JS web application be structured on the client-side (espertially if u are using a client side framework)? Specifically I'm curious about how to cleanly structure the application in terms of its model objects, UI components, any controllers, and objects handling server persistence.
I can speak in terms of Rails/Backbone, but I can't imagine that Django would be much different.
First, a client-side MVC framework like Backbone isn't just for single-paged apps. You can also use it to add some rich interaction to one or many views of a more traditional app. They simply provide structure and data abstractions on the client.
Next, these client-side frameworks are designed specifically to work with your back-end MVC frameworks. Backbone.js (since you tagged it specifically) models and collections work with REST services. They will talk via GET/POST/PUT/DELETE verbs and will ultimately communicate with your controllers on the back-end when they make asynchronous requests.
In the case of Backbone, it talks JSON instead of HTML. In the case of Rails, this is really easily handled in the controller. If the request is an HTML one, then you return a view as HTML. If it is a JSON request (*.json or Content-type) then the controller returns a JSON representation of the data. I am assuming that it is as easy in Django as it is in Rails to have the same controller respond to multiple content requests (HTML, XML, JSON, etc)