Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- how do i pass get parameters, the old school way like http://localhost:8000/check_serverip/?ip=127.0.0.1
- and using django pretty url(don't know how i would pass that) to my views?
- """
- #url.py
- from django.conf.urls import patterns, include, url
- from django.contrib import admin
- from monitor import views
- admin.autodiscover()
- urlpatterns = patterns('',
- # Examples:
- # url(r'^$', 'sysradar.views.home', name='home'),
- # url(r'^blog/', include('blog.urls')),
- url(r'^check_serverip/$', views.check_serverip),
- url(r'^admin/', include(admin.site.urls)),
- )
- #views.py
- from django.shortcuts import render
- from django.http import HttpResponse
- from radar.server_radar.checkserver import MyBox
- # Create your views here.
- def check_serverip(request):
- ip = request.GET.get('ip', '')
- box = MyBox()
- box_status = box.box_alive(ip)
- return HttpResponse("The Box with IP: %s is %s" % (ip, box_status))
- #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement