I am developing an application (API) in python, and I would like to offer some of its functions through a web interface (e.g. web services). I looked at the django, but I don’t know if this fits my idea well. I just want to create a webpage that calls my API methods to implement functions that offer this webpage. But after the tutorial, I'm a little confused about the django point. It seems to me that I'm more connected with ORM than with a classic web application.
Is django so difficult for such a simple development (as I mentioned, making calls in my API over the Internet)? Do I always need to use a database?
Thank.
django, , ! , urls.py views.py, URL- , , HTTP.
. urls.py
urlpatterns += patterns('myapp.views', url(r'^getstuff/$', 'getstuff' ), )
views.py
def getstuff(request): do whatever in python return HttpResponse(stuff to return)
Django. django , MVC ( MVT, ). , , URL-, ..
, :
, familiar , URL-, . , , django.
- , -. , - .
: , - , Apache, "-" ( ) ?
Apache, - Werkzeug, WSGI . Jinja2.
, , , , (-, , - HTML XML, , URL-), SimpleHTTPServer CGIHTTPServer , Python.
Django - , , - . , ( , ), , , .
. wsgi , . WebOb
Raw wsgi
def application(environ, start_response): start_response("200 OK", []) return ["<html><body><h1>Hello World</h1></body></html>"]
webob
from webob.dec import wsgify from webob import Request @wsgify def application(request): return Response("<html><body><h1>Hello World</h1></body></html>")
, apache mod_wsgi, , , / Webob. , Turbogears 2 repoze.bfg .
Django. , . - Python, .
Source: https://habr.com/ru/post/1751879/More articles:Can I change the Android style in ListView style without creating a custom list? - androidiOS4: Fix SDK settings and deployment targets in Xcode - iphoneВыдержка из массива Php с использованием условий - arraysruby on rails with existing database - ruby | fooobar.comInputBox Cancel - vb6Find all C ++ type X objects on the heap using WinDbg - windbgScala / Elevator: configure hotdeploy via Eclipse? - eclipseJQuery speed: which one is faster, {ul # parent li} or {li.child}? - jqueryHow to write to the console in Google App Engine (JAVA)? - javaLocal thread storage - c ++All Articles