This shows you the differences between two versions of the page.
— |
downloadandinstallationdjango [2014/09/16 13:59] (current) wikiadmin created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | [[http://www.djangoproject.com/|Django]] is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. | ||
+ | |||
+ | Developed and used over two years by a fast-moving online-news operation, Django was designed to handle two challenges: the intensive deadlines of a newsroom and the stringent requirements of the [[http://www.djangoproject.com/documentation/faq/#who-s-behind-this|experienced Web developers who wrote it]]. It lets you build high-performing, elegant Web applications quickly. | ||
+ | |||
+ | Django focuses on automating as much as possible and adhering to the [[http://c2.com/cgi/wiki?DontRepeatYourself|DRY principle]]. | ||
+ | |||
+ | ====== Where to download kits ====== | ||
+ | The recommended way to install Django on OpenVMS is to install the Portable Python kit, for more information view [[DownloadAndInstallationPython|Download and installation of Python for OpenVMS]] | ||
+ | |||
+ | ====== How to install/run Django on OpenVMS ====== | ||
+ | Django for Python is already installed in the Portable Python LD image. The root Django source tree is defined using the logical django_root. | ||
+ | |||
+ | Django for Python includes an Oracle/Rdb backend, so you can develop/deploy using SQLite3 (OpenVMS 8.2 minimum), MySQL, Oracle (need to build a Python module not provided in the Python for OpenVMS distribution), or Rdb. | ||
+ | |||
+ | ===== Setup an application ===== | ||
+ | ==== Django setup ==== | ||
+ | <code> | ||
+ | $ @django_root:[vms]setup | ||
+ | </code> | ||
+ | ==== Starting a Project ==== | ||
+ | $ python /django_root/django/bin/django-admin.py startproject mysite | ||
+ | |||
+ | :!: Create the project in a directory which has ben created using /version=1. | ||
+ | |||
+ | ==== Test the newly created project ==== | ||
+ | For example, if you want to start a server on port 8000 on IP adress 192.168.0.100: | ||
+ | |||
+ | <code> | ||
+ | $ set default [.mysite] | ||
+ | $ python manage.py runserver --noreload 192.168.0.100:8000 | ||
+ | Validating models... | ||
+ | 0 errors found | ||
+ | |||
+ | Django version 0.97-pre-SVN-unknown, using settings 'mysite.settings' | ||
+ | Development server is running at http://192.168.0.100:8000/ | ||
+ | Quit the server with CONTROL-C. | ||
+ | </code> | ||
+ | Note: --noreload is mandatory on OpenVMS | ||
+ | |||
+ | For more information read chapter 2 of the [[http://www.djangobook.com/|Django book]] | ||
+ | |||
+ | ===== Django and WASD ===== | ||
+ | A cgiplus example: | ||
+ | |||
+ | <code> | ||
+ | $ set default where_is_your_application | ||
+ | $ mcr cgi_exe:pyrte sys$input | ||
+ | import os | ||
+ | import sys | ||
+ | import wasd | ||
+ | |||
+ | # This has to be done here otherwise Django won't be in a directory | ||
+ | # that's in PYTHONPATH. | ||
+ | sys.path.append('/django_root/') | ||
+ | sys.path.append('../') | ||
+ | |||
+ | from django.core.handlers.wsgi import WSGIHandler | ||
+ | |||
+ | if __name__ == '__main__': | ||
+ | os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' | ||
+ | application = WSGIHandler() | ||
+ | while wasd.cgiplus_begin(): | ||
+ | wasd.wsgi_run(application) | ||
+ | </code> | ||
+ | ===== More information ===== | ||
+ | Django on OpenVMS is similar to Django on any other platform. So [[http://www.djangoproject.com/|Django official Web site]] and [[http://www.djangobook.com/|Django book]] are recommended reading. | ||
+ | |||
+ | Have fun! | ||