Exemple #1
0
def start():
    """Target for the `place_server` command"""
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "placeweb.settings")
    try:
        from django.core.management import execute_from_command_line
    except ImportError as exc:
        raise ImportError(
            "Couldn't import Django. Are you sure it's installed and "
            "available on your PYTHONPATH environment variable? Did you "
            "forget to activate a virtual environment?"
        ) from exc
    config = PlaceConfig()
    ip_addr = config.get_config_value('Django', 'ip_address', '127.0.0.1')
    port = config.get_config_value('Django', 'port', '8000')
    address = '{}:{}'.format(ip_addr, port)
    print(INTRO)
    execute_from_command_line(['', 'runserver', address])
Exemple #2
0
    def config(self, metadata, total_updates):
        """
        Configure the EPR-3000 electronic pressure regulator.
        """

        self.name = self.__class__.__name__

        # Initialise configuration variables
        _place_config = PlaceConfig()
        self.serial_port = _place_config.get_config_value(
            self.name, 'serial_port')
        self.max_p = float(
            _place_config.get_config_value(self.name, 'maximum_pressure'))
        self.min_p = float(
            _place_config.get_config_value(self.name, 'minimum_pressure'))
        self.tolerance = float(
            _place_config.get_config_value(self.name, 'tolerance'))
        self.press_incrs_min = float(
            _place_config.get_config_value(self.name,
                                           'pressure_increase_minimum'))
        self.press_incrs_min_time_period = float(
            _place_config.get_config_value(
                self.name, 'pressure_increase_minimum_time_period'))
        self.press_decrs_min = float(
            _place_config.get_config_value(self.name,
                                           'pressure_decrease_minimum'))
        self.press_decrs_min_time_period = float(
            _place_config.get_config_value(
                self.name, 'pressure_decrease_minimum_time_period'))
        self.max_adjustment_wait_time = float(
            _place_config.get_config_value(self.name,
                                           'max_adjustment_wait_time'))

        metadata[self.name + '-units'] = self._config['units']

        # Initialise serial
        self.reg = serial.Serial(self.serial_port,
                                 baudrate=19200,
                                 bytesize=serial.EIGHTBITS,
                                 parity=serial.PARITY_NONE,
                                 stopbits=serial.STOPBITS_ONE)

        self.reg.flushOutput()
        self.reg.flushInput()
        self.reg.write(bytes('*@=A\r'.encode('ascii')))  #Set to polling mode

        # Go to the starting pressure
        self.starting_press = self._config['start_pressure']
        self._set_pressure(self.starting_press, monitor=True)
Exemple #3
0
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""

import os
from place.config import PlaceConfig

config = PlaceConfig()

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
MEDIA_ROOT = config.get_config_value('Django', 'experiment_root',
                                     os.path.expanduser('~/.place'))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '768y90xswp36e=3x8y4r7twt#d4q+o&obfs13*^t+m9hoi$u-='

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = [config.get_config_value('Django', 'ip_address', '127.0.0.1')]

# Application definition

INSTALLED_APPS = [
Exemple #4
0
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""

import os
from place.config import PlaceConfig

config = PlaceConfig()

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
MEDIA_ROOT = config.get_config_value(
    'Django',
    'experiment_root',
    os.path.expanduser('~/.place'))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '768y90xswp36e=3x8y4r7twt#d4q+o&obfs13*^t+m9hoi$u-='

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = [config.get_config_value('Django',
                                         'ip_address',
                                         '127.0.0.1')]