python_wiki:django_api

This is an old revision of the document!


Django API

General Information

Interacting with the Django Python API.

Checklist


Imports

Imports and settings to add to your Python script in order to use your Django App's built in API.

Import and Settings

#!/usr/bin/python
 
# Import Django WSGI App Loading capabilities
from django.core.wsgi import get_wsgi_application
 
##- Configure Django Settings to point to your App -##
# sys.path = where manage.py is
sys.path.append('/home/django/myprojecthere')
 
# Settings Module = projectname.settings
os.environ["DJANGO_SETTINGS_MODULE"] = 'myprojecthere.settings'
application = get_wsgi_application()
 
# Import Django App Model (from 'myapphere' app)
from myapphere.models import AssetEntry

Using Your Apps API

Different ways to get your app data.

FIXME - To Do

FIXME - To Do


  • python_wiki/django_api.1533355003.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)