Skip to content
This repository has been archived by the owner on Nov 29, 2017. It is now read-only.
/ site-client Public archive

client tier for the Python TEDxBerkeley website (deprecated)

License

Notifications You must be signed in to change notification settings

TEDxBerkeley/site-client

Repository files navigation

#TEDxBerkeley Client Tier

This is the TEDxBerkeley client tier for tedxberkeley.org.

Getting Started

Here is how to setup a local instance.

  1. Check that needed commands are accessible source check.sh.
  2. Install source install.sh.
  3. Run server source activate.sh.
  4. Browse Client Core Documentation. (coming soon)
  5. Read the Guidelines below.
  6. If you are uncertain of where to start, see How to get Working below.

To update your installation of the client core, use:

  1. git submodule foreach git reset head --hard to remove any inadvertent changes.
  2. git submodule foreach git pull origin master to update the submodules.

Guidelines

  1. It is safer not to modify the core client submodule, which is located in the client directory from this repository. If you wish to make edits, clone the client repository and make edits there.
  2. Make all edits in a new branch. After creating a branch, immediately create a Pull Request (PR), but include [do not merge] in the title, so that your teammates can comment and collaborate on the branch.
  3. Once the branch is ready, remove [do not merge] and alert your code partner that it is ready for code review.
  4. Do not merge your own PRs, unless it is a critical bug fix and all tests pass.
  5. Conform to PEP style guidelines.
  6. Rename the "template" folder in this repository's root to your application's name.

How It Works

Detailed Explanation

This tier is quite simply a Flask application, except with a custom API instead of a datastore. For a primer, see Flask documentation.

To begin, the run.py file, in the repository root directory, creates an instance of the app, and then runs it. This app is defined in template_client/__init__.py. In that file, a number of items are necessary for this to function:

  1. Updating sys.path with the logic directory. This allows your application to access the logic core as a module named logic.
  2. In create_template_app, it is necessary to import views after the app is instantiated.
  3. In created_template_app, it is necessary to invoke app.register_blueprints after importing the file that registers your APIs.

In the template_client/views.py file, "views" define output for a specific or a set of URLs. Those URLs may inject Python values into an HTML template, using a powerful templating language, called Jinja.

All objects have five default operations, matching default objects in the logic tier: post (create), get, put (update), delete, and get_or_create. Note that get_or_create takes only one API call.

##How to get Working

If all of the above is confusing, then simply respect the application's abstractions and know the following. These should compartmentalize the application enough, so that you don't need to know how the rest of it works.

  1. Create a view in view.py with the right decorator.
  2. Create a new object in libs/sample.py that extends Entity.
  3. Import, instantiate and save your object inside your new view in view.py.
  4. Return a stringified version of your object.
  5. Finally, access the URL specified for your view.

About

client tier for the Python TEDxBerkeley website (deprecated)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published