Skip to content

Commit

Permalink
Rename of brewpi_django -> fermentrack_django
Browse files Browse the repository at this point in the history
Should only contain, renaming changes.

I have tested:

 - Install from scratch
  - make secret settings
  - manage.py migrate
 - Running under circus
 - Adding new controllers

Everything seems to work as before, new "basepath" is now ~/fermentrack
  • Loading branch information
stone committed Feb 15, 2017
1 parent 409fc75 commit 3437559
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion app/device_forms.py
@@ -1,7 +1,7 @@
from django import forms
from app.models import BrewPiDevice, OldControlConstants, NewControlConstants, SensorDevice, FermentationProfile
from django.core import validators
import brewpi_django.settings as settings
import fermentrack_django.settings as settings

from django.forms import ModelForm

Expand Down
2 changes: 1 addition & 1 deletion app/git_integration.py
@@ -1,6 +1,6 @@

from git import Repo
import brewpi_django.settings as settings
import fermentrack_django.settings as settings


def local_and_remote_are_at_same_commit(repo, remote):
Expand Down
2 changes: 1 addition & 1 deletion app/models.py
Expand Up @@ -9,7 +9,7 @@
import socket
import json, time, datetime, pytz
from constance import config
from brewpi_django import settings
from fermentrack_django import settings
import re


Expand Down
2 changes: 1 addition & 1 deletion app/profile_forms.py
@@ -1,7 +1,7 @@
from django import forms
from app.models import FermentationProfile, FermentationProfilePoint
from django.core import validators
import brewpi_django.settings as settings
import fermentrack_django.settings as settings

from django.forms import ModelForm

Expand Down
2 changes: 1 addition & 1 deletion app/views.py
Expand Up @@ -14,7 +14,7 @@
import git_integration
import subprocess

import brewpi_django.settings as settings
import fermentrack_django.settings as settings



Expand Down
2 changes: 1 addition & 1 deletion brewpi-script/brewpi.py
Expand Up @@ -22,7 +22,7 @@
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# This is so Django knows where to find stuff.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "brewpi_django.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fermentrack_django.settings")
sys.path.append(BASE_DIR)

# This is so my local_settings.py gets loaded.
Expand Down
6 changes: 3 additions & 3 deletions circus.ini
Expand Up @@ -4,10 +4,10 @@ endpoint = tcp://127.0.0.1:5555
pubsub_endpoint = tcp://127.0.0.1:5556
stats_endpoint = tcp://127.0.0.1:5557
loglevel = ERROR
logoutput = $(circus.env.HOME)/brewpi-django/log/circusd.log
logoutput = $(circus.env.HOME)/fermentrack/log/circusd.log

[watcher:Fermentrack]
cmd = $(circus.env.HOME)/venv/bin/chaussette --fd $(circus.sockets.Fermentrack) brewpi_django.wsgi:application
cmd = $(circus.env.HOME)/venv/bin/chaussette --fd $(circus.sockets.Fermentrack) fermentrack_django.wsgi:application
use_sockets = True
numprocesses = 2

Expand All @@ -16,7 +16,7 @@ host = 0.0.0.0
port = 8123

[watcher:brewpi-spawner]
cmd = $(circus.env.HOME)/venv/bin/python $(circus.env.HOME)/brewpi-django/brewpi_django/brewpi_spawner.py
cmd = $(circus.env.HOME)/venv/bin/python $(circus.env.HOME)/fermentrack/fermentrack_django/brewpi_spawner.py
use_sockets = False
numprocesses = 1

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/index.md
Expand Up @@ -54,6 +54,6 @@ Look - I haven't written any documentation for this yet, but I figure everything

This is a pretty standard Django app for most intents and purposes. You'll need to create the database (manage.py migrate iirc) - I'm targeting SQLite due to the easy deployment, but nothing prevents using postgres or mysql if that's what you prefer. You'll also need to create a superuser (manage.py createsuperuser) if you want to use the admin. It's optional.

The last thing you'll need to do is create the /brewpi_django/secretsettings.py file. I've created an example of this file called /brewpi_django/secretsettings.py.example . It's basic, for now.
The last thing you'll need to do is create the /fermentrack_django/secretsettings.py file. I've created an example of this file called /fermentrack_django/secretsettings.py.example . It's basic, for now.

If you think about the main BrewPi project, you have three main components - BrewPi-www, BrewPi-script, and the BrewPi firmware. This project seeks to replace BrewPi-www, and uses a replacement for BrewPi-script (which is in a subdirectory of the same name). Using this instance of Brewpi-script is mandatory for this project to function.
File renamed without changes.
Expand Up @@ -10,7 +10,7 @@
# Load up the Django specific stuff
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# This is so Django knows where to find stuff.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "brewpi_django.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fermentrack_django.settings")
sys.path.append(BASE_DIR)
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
Expand All @@ -30,7 +30,7 @@ def __init__(self, model,
sleep_interval=SLEEP_INTERVAL,
command_tmpl='python -u brewpi-script/brewpi.py --dbcfg %s',
circus_endpoint=DEFAULT_ENDPOINT_DEALER,
logfilepath=os.path.expanduser("~/brewpi-django/log"),
logfilepath=os.path.expanduser("~/fermentrack/log"),
log=LOG
):
self.prefix = prefix
Expand Down Expand Up @@ -172,7 +172,7 @@ def run_forvever(self):
if __name__ == '__main__':
# Chill so that circus has time to startup
time.sleep(5)
cmd_tmpl = "python -u " + os.path.expanduser("~/brewpi-django/brewpi-script/brewpi.py") + " --dbcfg %s"
cmd_tmpl = "python -u " + os.path.expanduser("~/fermentrack/brewpi-script/brewpi.py") + " --dbcfg %s"
process_spawner = BrewPiSpawner(model=models.BrewPiDevice, command_tmpl=cmd_tmpl, prefix="dev-")
process_spawner.run_forvever()

File renamed without changes.
8 changes: 4 additions & 4 deletions brewpi_django/settings.py → fermentrack_django/settings.py
@@ -1,5 +1,5 @@
"""
Django settings for brewpi_django project.
Django settings for fermentrack_django project.
Generated by 'django-admin startproject' using Django 1.10.2.
Expand All @@ -14,7 +14,7 @@
from django.contrib.messages import constants as message_constants # For the messages override
import datetime, pytz

from secretsettings import * # See brewpi_django/secretsettings.py.example, or run utils/make_secretsettings.sh
from secretsettings import * # See fermentrack_django/secretsettings.py.example, or run utils/make_secretsettings.sh

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Expand Down Expand Up @@ -55,7 +55,7 @@
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'brewpi_django.urls'
ROOT_URLCONF = 'fermentrack_django.urls'

TEMPLATES = [
{
Expand All @@ -74,7 +74,7 @@
},
]

WSGI_APPLICATION = 'brewpi_django.wsgi.application'
WSGI_APPLICATION = 'fermentrack_django.wsgi.application'


# Database
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions brewpi_django/wsgi.py → fermentrack_django/wsgi.py
@@ -1,5 +1,5 @@
"""
WSGI config for brewpi_django project.
WSGI config for fermentrack_django project.
It exposes the WSGI callable as a module-level variable named ``application``.
Expand All @@ -11,6 +11,6 @@

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "brewpi_django.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fermentrack_django.settings")

application = get_wsgi_application()
2 changes: 1 addition & 1 deletion manage.py
Expand Up @@ -3,7 +3,7 @@
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "brewpi_django.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fermentrack_django.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
Expand Down
8 changes: 4 additions & 4 deletions utils/make_secretsettings.sh
Expand Up @@ -5,14 +5,14 @@ myPath="$( cd "$( dirname "${BASH_SOURCE[0]}")" && pwd )"

# This script populates secretsettings.py (which contains the SECRET_KEY and not much else at the moment
# SECRET_KEY is a 50 character alphanumeric string that is used within Django
echo "Generating SECRET_KEY and writing to brewpi_django/secretsettings.py"
echo "Generating SECRET_KEY and writing to fermentrack_django/secretsettings.py"

SECRET_KEY_STRING=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 50 | head -n 1)

if [ -f "$myPath/../brewpi_django/secretsettings.py" ]; then
if [ -f "$myPath/../fermentrack_django/secretsettings.py" ]; then
echo "Removing old secretsettings.py file.."
rm "$myPath/../brewpi_django/secretsettings.py" # In case it exists
rm "$myPath/../fermentrack_django/secretsettings.py" # In case it exists
fi

echo "SECRET_KEY = '${SECRET_KEY_STRING}'" >> "$myPath/../brewpi_django/secretsettings.py"
echo "SECRET_KEY = '${SECRET_KEY_STRING}'" >> "$myPath/../fermentrack_django/secretsettings.py"
echo "secretsettings.py created!"

0 comments on commit 3437559

Please sign in to comment.