diff --git a/INSTALL.md b/INSTALL.md index 54f82731..fddfc3ff 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -32,8 +32,6 @@ Django-orchestra can be installed on any Linux system, however it is **strongly cd ~orchestra orchestra-admin startproject # e.g. panel cd - sudo touch /var/log/orchestra.log - sudo chown orchestra /var/log/orchestra.log ``` 5. Create and configure a Postgres database diff --git a/INSTALLDEV.md b/INSTALLDEV.md new file mode 100644 index 00000000..1ce82565 --- /dev/null +++ b/INSTALLDEV.md @@ -0,0 +1,46 @@ +Development and Testing Setup +----------------------------- +If you are planing to do some development you may want to consider doing it under the following setup + + +1. Create a basic [LXC](http://linuxcontainers.org/) container, start it and get inside. + ```bash + wget -O /tmp/create.sh \ + https://raw.github.com/glic3rinu/django-orchestra/master/scripts/container/create.sh + sudo bash /tmp/create.sh + sudo lxc-start -n orchestra + # root/root + ``` + +2. Deploy Django-orchestra development environment **inside the container** + ```bash + # Make sure your container is connected to the Internet + # Probably you will have to configure the NAT first: + # sudo iptables -t nat -A POSTROUTING -s `container_ip` -j MASQUERADE + wget -O /tmp/deploy.sh \ + https://raw.github.com/glic3rinu/django-orchestra/master/scripts/container/deploy.sh + cd /tmp/ # Moving away from /root before running deploy.sh + bash /tmp/deploy.sh + ``` + Django-orchestra source code should be now under `~orchestra/django-orchestra` and an Orchestra instance called _panel_ under `~orchestra/panel` + + +3. Nginx should be serving on port 80, but Django's development server can be used as well: + ```bash + su - orchestra + cd panel + python manage.py runserver 0.0.0.0:8888 + ``` + +4. A convenient practice can be mounting `~orchestra` on your host machine so you can code with your favourite IDE, sshfs can be used for that + ```bash + # On your host + mkdir ~/orchestra + sshfs orchestra@: ~/orchestra + ``` + +5. To upgrade to current master just re-run the deploy script + ```bash + sudo ~orchestra/django-orchestra/scripts/container/deploy.sh + ``` + diff --git a/README.md b/README.md index d6cdaacc..a1972a68 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,8 @@ However, Orchestra also provides glue, tools and patterns that you may find very Fast Deployment Setup --------------------- -To only run the web interface follow these steps: +This deployment is not suitable for production but more than enough for checking out this project. +Notice that it does not require external dependencies. ```bash # Create and activate a Python virtualenv @@ -42,7 +43,8 @@ source env-django-orchestra/bin/activate pip3 install django-orchestra==dev \ --allow-external django-orchestra \ --allow-unverified django-orchestra -sudo apt-get install python3.4-dev libxml2-dev libxslt1-dev libcrack2-dev +# The only non-pip required dependency is python3-dev: +# sudo apt-get install python3.4-dev pip3 install -r \ https://raw.githubusercontent.com/glic3rinu/django-orchestra/master/requirements.txt @@ -51,55 +53,15 @@ orchestra-admin startproject panel python3 panel/manage.py migrate accounts python3 panel/manage.py migrate python3 panel/manage.py runserver + +# Enable periodic tasks with cron (optional) +python3 panel/manage.py setupcronbeat ``` -None of the services will work but you can see the web interface on http://localhost:8000/admin +Now you can see the web interface on http://localhost:8000/admin -Development and Testing Setup ------------------------------ -If you are planing to do some development or perhaps just checking out this project, you may want to consider doing it under the following setup - -1. Create a basic [LXC](http://linuxcontainers.org/) container, start it and get inside. - ```bash - wget -O /tmp/create.sh \ - https://raw.github.com/glic3rinu/django-orchestra/master/scripts/container/create.sh - sudo bash /tmp/create.sh - sudo lxc-start -n orchestra - # root/root - ``` - -2. Deploy Django-orchestra development environment **inside the container** - ```bash - # Make sure your container is connected to the Internet - # Probably you will have to configure the NAT first: - # sudo iptables -t nat -A POSTROUTING -s `container_ip` -j MASQUERADE - wget -O /tmp/deploy.sh \ - https://raw.github.com/glic3rinu/django-orchestra/master/scripts/container/deploy.sh - cd /tmp/ # Moving away from /root before running deploy.sh - bash /tmp/deploy.sh - ``` - Django-orchestra source code should be now under `~orchestra/django-orchestra` and an Orchestra instance called _panel_ under `~orchestra/panel` - - -3. Nginx should be serving on port 80, but Django's development server can be used as well: - ```bash - su - orchestra - cd panel - python manage.py runserver 0.0.0.0:8888 - ``` - -4. A convenient practice can be mounting `~orchestra` on your host machine so you can code with your favourite IDE, sshfs can be used for that - ```bash - # On your host - mkdir ~/orchestra - sshfs orchestra@: ~/orchestra - ``` - -5. To upgrade to current master just re-run the deploy script - ```bash - sudo ~orchestra/django-orchestra/scripts/container/deploy.sh - ``` +Checkout the steps for other deployments: [development](INSTALLDEV.md), [production](INSTALL.md) License diff --git a/orchestra/bin/orchestra-admin b/orchestra/bin/orchestra-admin index 35448916..448b2718 100755 --- a/orchestra/bin/orchestra-admin +++ b/orchestra/bin/orchestra-admin @@ -133,8 +133,8 @@ function install_requirements () { ca-certificates \ gettext" + # cracklib and lxml are excluded on the requirements because they are hard to build PIP="$(wget https://raw.githubusercontent.com/glic3rinu/django-orchestra/master/requirements.txt -q -O - | tr '\n' ' ') \ - https://github.com/glic3rinu/passlib/archive/master.zip \ cracklib \ lxml==3.3.5" diff --git a/orchestra/conf/project_template/project_name/settings.py b/orchestra/conf/project_template/project_name/settings.py index 6c63c438..81462018 100644 --- a/orchestra/conf/project_template/project_name/settings.py +++ b/orchestra/conf/project_template/project_name/settings.py @@ -179,6 +179,50 @@ AUTHENTICATION_BACKENDS = [ ] +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'formatters': { + 'simple': { + 'format': '%(asctime)s %(name)s %(levelname)s %(message)s' + }, + }, + 'filters': { + 'require_debug_false': { + '()': 'django.utils.log.RequireDebugFalse', + }, + 'require_debug_true': { + '()': 'django.utils.log.RequireDebugTrue', + }, + }, + 'handlers': { + 'file': { + 'level': 'DEBUG', + 'class': 'logging.FileHandler', + 'filename': os.path.join(BASE_DIR, 'orchestra.log'), + 'formatter': 'simple' + }, + 'console': { + 'level': 'INFO', + 'filters': ['require_debug_true'], + 'class': 'logging.StreamHandler', + }, + }, + 'loggers': { + 'orchestra': { + 'handlers': ['file', 'console'], + 'level': 'INFO', + 'propagate': True, + }, + 'orm': { + 'handlers': ['file',], + 'level': 'INFO', + 'propagate': True, + }, + }, +} + + ################################# ## 3RD PARTY APPS CONIGURATION ## ################################# diff --git a/orchestra/contrib/payments/methods/options.py b/orchestra/contrib/payments/methods/options.py index fce3215c..42b058b9 100644 --- a/orchestra/contrib/payments/methods/options.py +++ b/orchestra/contrib/payments/methods/options.py @@ -26,7 +26,7 @@ class PaymentMethod(plugins.Plugin): try: plugins.append(import_class(cls)) except ImportError as exc: - logger.error(str(exc)) + logger.error('Error loading %s: %s' % (cls, str(exc))) return plugins def get_label(self): diff --git a/requirements.txt b/requirements.txt index 9981a207..ed7cd600 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,6 +17,7 @@ Pygments==1.6 django-filter==0.7 jsonfield==0.9.22 python-dateutil==2.2 +https://github.com/glic3rinu/passlib/archive/master.zip django-iban==0.3.0 requests phonenumbers