← Revision 1 as of 2012-07-06 18:28:00 →
25
Comment:
|
3260
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
Describe AppStore here. |
= App Store Code Structure = == Terminology == * ''Django app'': Django organizes websites into separate modules called apps. Each app has its own directory at the top level typically containing files like {{{__init__.py}}}, {{{model.py}}}, and {{{views.py}}}. * ''templates'': HTML files with placeholders, which Django processes by filling in Python code. * ''static files'': general website files (images, Java Script, CSS) that are served as is without any processing from Django. * ''media files'': general website files referenced by the database backend. == Explanation of important files == * {{{settings.py}}}: Django settings file for configuring things like the database, location of templates, static files, and so on. * {{{urls.py}}}: the general URL layout of the entire site. Each URL entry in this file delegates URL paths to each Django app. * {{{django.wsgi}}}: the configuration file used when the App Store is deployed to an Apache server using mod_wsgi. * {{{apps}}}: navigation of Cytoscape apps and app pages. * {{{users}}}: user login/logout. * {{{search}}}: free text searching. * {{{backend}}}: programs can obtain details of apps from the backend; used by the Cytoscape App Manager * {{{help}}}: about, contact us, getting started pages * {{{submit_app}}}: Cytoscape 3.0 app submission pages and jar verification * {{{templates}}}: Templates in this directory are used throughout the App Store. * {{{static}}}: Each subdirectory has static files for a Django app. The {{{common}}} subdirectory has static files that belong to the entire site. When deploying the site to Apache, Apache should directly serve these files instead of through Django. * {{{util}}}: small utility functions used throughout the site's code = Debugging = 1. {{{/etc/apache2/sites-enabled/appstore}}} This file tells Apache and mod_wsgi where to find the site. The most important line is this: {{{ WSGIScriptAlias / /var/www/CyAppStore/django.wsgi }}} This tells Apache and mod_wsgi where to locate the site code. Make sure the path to {{{django.wsgi}}} is correct. 1. {{{/var/www/CyAppStore/django.wsgi}}} This file invokes Django's WSGI handler. It needs to correctly reference {{{settings.py}}} to start the site. Make sure these two lines correctly reference the location of the site: {{{ SITE_PARENT_DIR = '/var/www' SITE_DIR = filejoin(SITE_PARENT_DIR, 'CyAppStore') }}} To check if these variables are being defined correctly, you can launch a separate Python interpreter and enter these lines: {{{ from os.path import join as filejoin SITE_PARENT_DIR = '/var/www' SITE_DIR = filejoin(SITE_PARENT_DIR, 'CyAppStore') }}} Then check if the variables {{{SITE_PARENT_DIR}}} and {{{SITE_DIR}}} are correct. 1. {{{/var/www/CyAppStore/settings.py}}} This file is pretty complicated. But if you've checked everything at this point, here's some ways to pinpoint problems in {{{settings.py}}}. a. s a. If you're getting database errors, enter this command at the shell prompt in the same directory as {{{settings.py}}}: {{{ python manage.py dbshell }}} If you're able to get a SQL prompt, that means the log in settings into the SQL database is correct. |
App Store Code Structure
Terminology
Django app: Django organizes websites into separate modules called apps. Each app has its own directory at the top level typically containing files like __init__.py, model.py, and views.py.
templates: HTML files with placeholders, which Django processes by filling in Python code.
static files: general website files (images, Java Script, CSS) that are served as is without any processing from Django.
media files: general website files referenced by the database backend.
Explanation of important files
settings.py: Django settings file for configuring things like the database, location of templates, static files, and so on.
urls.py: the general URL layout of the entire site. Each URL entry in this file delegates URL paths to each Django app.
django.wsgi: the configuration file used when the App Store is deployed to an Apache server using mod_wsgi.
apps: navigation of Cytoscape apps and app pages.
users: user login/logout.
search: free text searching.
backend: programs can obtain details of apps from the backend; used by the Cytoscape App Manager
help: about, contact us, getting started pages
submit_app: Cytoscape 3.0 app submission pages and jar verification
templates: Templates in this directory are used throughout the App Store.
static: Each subdirectory has static files for a Django app. The common subdirectory has static files that belong to the entire site. When deploying the site to Apache, Apache should directly serve these files instead of through Django.
util: small utility functions used throughout the site's code
Debugging
/etc/apache2/sites-enabled/appstore
- This file tells Apache and mod_wsgi where to find the site. The most important line is this:
WSGIScriptAlias / /var/www/CyAppStore/django.wsgi
This tells Apache and mod_wsgi where to locate the site code. Make sure the path to django.wsgi is correct.
- This file tells Apache and mod_wsgi where to find the site. The most important line is this:
/var/www/CyAppStore/django.wsgi
This file invokes Django's WSGI handler. It needs to correctly reference settings.py to start the site. Make sure these two lines correctly reference the location of the site:
SITE_PARENT_DIR = '/var/www' SITE_DIR = filejoin(SITE_PARENT_DIR, 'CyAppStore')
To check if these variables are being defined correctly, you can launch a separate Python interpreter and enter these lines:from os.path import join as filejoin SITE_PARENT_DIR = '/var/www' SITE_DIR = filejoin(SITE_PARENT_DIR, 'CyAppStore')
Then check if the variables SITE_PARENT_DIR and SITE_DIR are correct.
/var/www/CyAppStore/settings.py
This file is pretty complicated. But if you've checked everything at this point, here's some ways to pinpoint problems in settings.py.
- s
If you're getting database errors, enter this command at the shell prompt in the same directory as settings.py:
python manage.py dbshell
If you're able to get a SQL prompt, that means the log in settings into the SQL database is correct.