Porting a GAE Django app to Azure AppFabric - django

I have a GAE+Django app and wanted to port it to Microsoft Azure AppFabric. What would be the best way to do this? It's sort of like a RESTful service with custom output that is neither JSON nor XML. All of the Azure samples force you to output either XML or JSON and I can't seem to find any samples outputting the raw output.
Any help/information will be appreciated. Thanks!

I believe it is possible, I haven't tried.
Here's a Channel 9 video on running Python on Windows Azure:
http://channel9.msdn.com/Shows/Cloud+Cover/Cloud-Cover-Episode-13-Running-Python-the-censored-edition

Yes it is possible. See https://www.windowsazure.com/en-us/develop/other/
Also https://github.com/smarx/pythonrole
So you should even be able to run django.

This is a bit late to the party, but here's a nicely packaged tutorial for running Django on Azure:
https://www.windowsazure.com/en-us/develop/python/tutorials/web-app-with-django/
Note that you can also run Linux instances raw in Azure if the rest of the PaaS isn't to your liking.

Related

I am using the python django, and i wanted to know to get use thingsboard dashboard, and database as postgresql

I am using the Python3, Django and database as Postgresql, and I wanted to use the Thingsboard dashboard in my web application. can anyone pls guide me how can I use this
ThingsBoard has APIs which you can use. You may also customise it based on your requirements.
Go to THINGSBOARD_URL/swagger-ui.html get the list of all available REST APIs and use it as per your requirements. http://localhost:8080/swagger-ui.html

Can we install django application without source code?

I have a requirement where I need to develop a Point of Sale system.
I want to know if it is possible to install that small point of sale app
on some machine without source code ?
Thanks for all suggestions.
I just thought I'd mention this for anybody that finds this question useful in the future.
There was a discussion about turning a Django webapp into a local app here:
https://groups.google.com/forum/#!topic/django-users/-VGqvHew35g
They provide some interesting solutions for converting the webapp into a local/desktop app.
Django is a web framework. There's no need to install any code on a client machine, since you would access it via a web browser.

Is there a way to extract data from Nagios as if it was a web service?

My situation: I'm working on a web monitoring dashboard that assembles informations from different applications and sources and generate graphs, info graphics and reports.
The applications I'm trying to integrate are CACTI, Nagios, and other local private monitoring tools. I had no problem to integrate these applications, except for Nagios (I don't have much experience with it).
What I want to know is if there is a way to use Nagios as a Web Service, or something similar, so I can expose some of the informations and use it to generate my own reports on my dashboard application.
Is it possible to do that without any epic effort?
thanks for reading.
Nagios 4.x starting with version 4.4 now includes CGIs for JSON output. Installing the newest version of Nagios might be the easiest way to go.
See the announcement here.
Review the slides from Nagios World Conference 2013 here.
The Check_MK Multisite GUI (Web base GUI using MK Livestatus) offers a web service mode, where you can send queries/commands as URL parameters and get the response as JSON in the body.
The trick is: Create a view in the GUI, which fits your needs. Then extract the URL of that view and add the parameter output_format=json. Now you should have the output in a parsable format.
For example, this URL should give you a JSON list of all services:
check_mk/view.py?view_name=allservices&output_format=json
You can try:
1) MK Livestatus http://mathias-kettner.de/checkmk_livestatus.html
it's not web service but it can give current data without any complicated action. All you need redirect this data.
2)status-json plugin http://exchange.nagios.org/directory/Addons/APIs/JSON/status-2Djson/details which return data in JSON format.
3)NagiosWS plugin but I wasn't able to get to work it yet. I think it can be done for Nagios 2.x
4)GroundWork Foundation plugin. I think I will try use it now.
I was able to get to work 1 and 2 solution now.
Otherwise you can use Icinga which can give you some JSON or XML output. Icinga is fork of Nagios and can be installed with saving all your nagios data and plugins. At least it written on Icinga's site =) They have some other solution like PHP lib.
Sorry, I cannot post only 2 link while I'm newbie on this site.
Best regards.
Worked for me - MK Livestatus http://mathias-kettner.de/checkmk_livestatus.html it's not web service but it can give current data without any complicated action. All you need redirect this data.

Django on Google App Engine

How much of a pain is it to run a Django App on App Engine? Also, does the Datastore work as-is with Django?
I spent some time trying to answer the same question... it seems to me that the most difficult thing to transfer to GAE are django's models... in the sense that they require various modifications and rethinking, mainly because GAE's backend is not a standard relational DB, but google's BigTable. I found a nice intro to this here:
http://www.youtube.com/watch?v=rRCx9e38yr8
Anyways, it's worth downloading one of those 'patches' and have a go with it!
For me the best solution is the 'app-engine-patch'. I downloaded the sample project and it worked straightaway! (Mind that you need to have GAE's SDK installed separately) A killer-feature for me is the fact that the django-admin and many other classic django functionalities have been ported too!!!
http://code.google.com/p/app-engine-patch/
The documentation is still quite minimal in my opinion, but it's good enough to get you going. It'll help you to skim though the official GAE docs though!
Just Yesterday (depending on your time zone), Google released a new SDK for Python on Appengine that supports django 1.0 out of the box.
You need to use django-nonrel (source).
You will still find loads of issues:
Many2Many relations not supported
Fake joins increase number of queries
App Engine doesn't allow any python lib with socket or C dependencies (sentry, lxml...)
You can try to get early access to CloudSQL.
Otherwise you are not constraint to use App Engine, you can think about using:
Heroku
Gondor
Cheaper and more control with support requirement files like pip.
31.01.2012, Google released App Engine 1.6.2 that supports Django out-of-the box.
App Engine includes version 0.96 of Django out-of-the-box, but it is quite crippled.
App Engine Helper and app-engine-patch supposedly fix this problem to some degree, but I haven't tried either myself.
http://code.google.com/appengine/articles/appengine_helper_for_django.html
http://code.google.com/appengine/articles/app-engine-patch.html
The amount of pain depends on how much existing code you want to reuse. Unfortunately because of the Datastore does not support SQL, you often cannot just take any django-pluggable app and use it on your GAE project.
App-engine-patch http://code.google.com/p/app-engine-patch/ looks to be ahead of the other django helpers in bringing the standard applications (Sites, ContentTypes, Flatpages) over to GAE. I have used app-engine-patch on several gae projects, and once you understand how to port a django-sql model to a django-gae model and converting sql to datastore queries things can be done very quickly - but there is always a learning curve.
appengine-helper tries to bridge the Datastore gap by providing a model so you don't have to change your model superclasses, but I've found that you end up having to change ManyToMany relationships and any sql anyway, so the advantage ends up being minimal. ae-patch has a roadmap to try to provide an ae-datastore backend, but it probably won't happen for a while.
Google has now launched their Cloud SQL storage. That is actually MySQL 5.5 in the cloud. IMO that's a very nice way to migrate your Django app into the cloud. They have a free trial up to June 1, 2013.
If you need some tips how to set up your Django project for Appengine and Cloud SQL I've written a tutorial for that.

Server Generated web screenshots?

One problem I've been toying with off and on is a service that requires my server to produce a screenshot of a webpage at a given url. The problem is that I don't have any idea how I would accomplish this. I mostly use a LAMP software stack, so answers that were given with that in mind would be the most helpful. Again the basic requirements are: Given a url, the server needs to produce an image file of the rendered web page at that url. Thanks in advance!
You might also want to take a look at webkit, it's known for being easier to embed (used by Adobe for AIR, by Google for Chrome, by Apple for the iPhone...) then other rendering engines. This might take a little more work to setup, but it would be a lot more stable than some hack that launched a webbrowser and took a screenshot.
IF your server is a Mac, then I recommend webkit2png, which is a short python program that leverages WebKit's Objective-C API to render an URL. Personally, I use it in combination with WWW::Mechanize to walk my development site and make screenshots of every page -- useful for testing functionality, showing clients and keeping screenshots up-to-date. The resulting screenshot is perfect, but sometimes very tall for long, scrolling pages.
IF your server has a non-bare-bones Linux distro with KDE installed, then you might try khtml2png. I have not tried that myself, but saw it mentioned on the webkit2png page.
PhantomJS is a headless (commandline) WebKit-based browser which can be easily scripted to save a screenshot of webpage.
You actually need to have the server launch the web browser in question and take a screenshot of the application with the appropriate libraries. Apache will not render the page for you so you have to have software that will.
Yes, that is what is needed. I do this in asp.net, and I actually create a WebBrowser object that is avaialable in the .Net framework class libraries to generate the screenshot.
I use the http://webthumb.bluga.net service for thumbnail generation. Robust, powerful, easy to use, and very reasonable rates. I have a high traffic production website using this service and it works very well. Given the difficulty of creating a robust web screenshot service, it's nice to have someone else do the hard work.
A non-free solution for Java is WebRenderer. Interesting feature: it can emulate Safari, IE or Firefox browsers when rendering. They have a desktop version and a headless server version. Also they have example code showing how to render a screenshot image of a webpage.
virtual framebuffer X server
I would rather recommend XVFB (virtual framebuffer X server) is the best solution for taking screenshots of a headless server. Virtual framebuffer X server xvfb provides an X server that can run on machines with no display hardware and no physical input devices.
I am using that on my server for testing URLs and taking its screenshot. We are using Ubuntu & XVFB + FIREFOX. It is working fine. Modify according to your needs.Take a look on these articles. It might be use full for you.
http://www.semicomplete.com/blog/geekery/xvfb-firefox.html
http://linux.about.com/cs/linux101/g/xvfb.htm
http://www.xfree86.org/4.0.1/Xvfb.1.html