Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #10 from demonduck/dev
Browse files Browse the repository at this point in the history
Capstone and Django ORM Migration
  • Loading branch information
demonduck authored Sep 11, 2017
2 parents 08821e1 + 2e2fe12 commit 422fd27
Show file tree
Hide file tree
Showing 42 changed files with 2,256 additions and 1,413 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ docs/_build/

# PyBuilder
target/
server/first_config.json
19 changes: 18 additions & 1 deletion docs/engines/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,29 @@ Engines
Engine Shell
============

The Python script ``engine_shell.py`` provides you with some functionality to manage engines installed into FIRST. Below you will see the script's operations.

.. code::
+========================================================+
| FIRST Engine Shell Menu |
+========================================================+
| list | List all engines currently installed |
| info | Get info on an engine |
| install | Installs engine |
| delete | Removes engine record but not other DB data |
| enable | Enable engine (Engine will be enabled) |
| populate | Sending all functions to engine |
| disable | Disable engine (Engine will be disabled) |
+--------------------------------------------------------+
Testing Engines
===============
TODO

.. autoclass:: first.engines.AbstractEngine
.. autoclass:: first_core.engines.AbstractEngine
:noindex:
:members:
:undoc-members:
17 changes: 12 additions & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Installing your own FIRST server can be quick and easy with an Ubuntu machine an

**After cloning the Git repo**

Save your google auth json information to install/google_secret.json
Save your google auth json information to install/google_secret.json. To generate a google_secret.json file you will need to go to https://console.developers.google.com, create a project, select the project, select Credentials in the left set of links under APIs & services. Once selected, select the Create credentials drop down menu and click OAuth client ID. Select Web application, and fill out the details. Once created you will have the option to down the JSON file containing the generated secret.

Optionally, you can add install/ssl/apache.crt and apache.key file if you have an SSL certificate you would prefer to use.

Expand All @@ -32,16 +32,23 @@ When the FIRST server is installed, no engines are installed. FIRST comes with t

.. note::

Before engines can be installed, the developer must be registered with the system. Ensure the developer is registered before progressing.
Before engines can be installed, the developer must be registered with the system. This can be accomplished through the web UI if OAuth has been setup or manually by the user_shell.py located in the utilities folder.

.. code::
$ cd FIRST-server/server/utilities
$ python user_shell.py <user_handle: johndoe#0001> <user email: [email protected]>
Ensure the developer is registered before progressing.

Python script ``engine_shell.py`` can be provided with command line arguments or used as a shell. To quickly install the three available engines run the below commands:

.. code::
$ cd FIRST-server/server/utilities
$ python engine_shell.py install first.engines.exact_match ExactMatchEngine <developer_email>
$ python engine_shell.py install first.engines.mnemonic_hash MnemonicHashEngine <developer_email>
$ python engine_shell.py install first.engines.basic_masking BasicMaskingEngine <developer_email>
$ python engine_shell.py install first_core.engines.exact_match ExactMatchEngine <developer_email>
$ python engine_shell.py install first_core.engines.mnemonic_hash MnemonicHashEngine <developer_email>
$ python engine_shell.py install first_core.engines.basic_masking BasicMaskingEngine <developer_email>
Once an engine is installed you can start using your FIRST installation to add and/or query for annotations. Without engines FIRST will still be able to store annotations, but will never return any results for query operations.

Expand Down
Empty file added server/engines/__init__.py
Empty file.
6 changes: 6 additions & 0 deletions server/engines/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.contrib import admin

# Register your models here.
8 changes: 8 additions & 0 deletions server/engines/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.apps import AppConfig


class EnginesConfig(AppConfig):
name = 'engines'
Empty file.
6 changes: 6 additions & 0 deletions server/engines/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models

# Create your models here.
6 changes: 6 additions & 0 deletions server/engines/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.test import TestCase

# Create your tests here.
6 changes: 6 additions & 0 deletions server/engines/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.shortcuts import render

# Create your views here.
15 changes: 15 additions & 0 deletions server/example_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"secret_key" : "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",

"db_engine" : "django.db.backends.mysql",
"db_dbname" : "first",
"db_user" : "user",
"db_password" : "pass",
"db_host" : "localhost",
"db_port" : 3306,

"debug" : true,
"allowed_hosts" : ["localhost", "testserver"],

"oauth_path" : "",
}
27 changes: 0 additions & 27 deletions server/first/__init__.py
Original file line number Diff line number Diff line change
@@ -1,27 +0,0 @@
#-------------------------------------------------------------------------------
#
# Intializes FIRST's DBManager and EngineManager
# Copyright (C) 2016 Angel M. Villegas
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
#-------------------------------------------------------------------------------

# FIRST Modules
from first.dbs import FIRSTDBManager
from first.engines import FIRSTEngineManager

DBManager = FIRSTDBManager()
EngineManager = FIRSTEngineManager(DBManager)
Loading

0 comments on commit 422fd27

Please sign in to comment.