diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000000000000000000000000000000000000..ccffd8a6c7a9e82eac676cd064b3f07333ee0f8b --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,89 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# All Vagrant configuration is done below. The "2" in Vagrant.configure +# configures the configuration version (we support older styles for +# backwards compatibility). Please don't change it unless you know what +# you're doing. +Vagrant.configure(2) do |config| + # The most common configuration options are documented and commented below. + # For a complete reference, please see the online documentation at + # https://docs.vagrantup.com. + + # Every Vagrant development environment requires a box. You can search for + # boxes at https://atlas.hashicorp.com/search. + config.vm.box = "centos/7" + + # Disable automatic box update checking. If you disable this, then + # boxes will only be checked for updates when the user runs + # `vagrant box outdated`. This is not recommended. + # config.vm.box_check_update = false + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine. In the example below, + # accessing "localhost:8080" will access port 80 on the guest machine. + config.vm.network "forwarded_port", guest: 8000, host: 8000 + + # Create a private network, which allows host-only access to the machine + # using a specific IP. + # config.vm.network "private_network", ip: "192.168.33.10" + + # Create a public network, which generally matched to bridged network. + # Bridged networks make the machine appear as another physical device on + # your network. + # config.vm.network "public_network" + + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + # config.vm.synced_folder "../data", "/vagrant_data" + + # Provider-specific configuration so you can fine-tune various + # backing providers for Vagrant. These expose provider-specific options. + # Example for VirtualBox: + # + # config.vm.provider "virtualbox" do |vb| + # # Display the VirtualBox GUI when booting the machine + # vb.gui = true + # + # # Customize the amount of memory on the VM: + # vb.memory = "1024" + # end + # + config.vm.provision "shell", inline: <<-SHELL + yum install -y python-virtualenv vim git gcc libevent-devel libxml2-devel libxslt-devel mariadb-server mysql-devel patch + rpm -Uh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + yum install -y beanstalkd + systemctl enable beanstalkd.service + service beanstalkd start + systemctl enable mariadb.service + service mariadb start + mysql -u root <<-SCRIPT + create database fod; +SCRIPT + mkdir -p /var/log/fod + virtualenv venv + ( + source venv/bin/activate + cd ~vagrant/sync + ( + cd flowspy + cp -f settings.py.dist settings.py + patch settings.py < settings.py.patch + ) + pip install -r requirements.txt + sed -i 's/from django.forms.util import smart_unicode/from django.utils.encoding import smart_unicode/' ~vagrant/venv/lib/python2.7/site-packages/tinymce/widgets.py + ./manage.py syncdb --noinput + ./manage.py migrate + + ) + + + echo "To activate virualenv: source ~vagrant/venv/bin/activate" + echo "To create a user run: cd ~vagrant/sync; ./manage.py createsuperuser" + echo "To start flowspy server: cd ~vagrant/sync; ./manage.py runserver 0.0.0.0:8000" + echo "To start celeryd: cd ~vagrant/sync; ./manage.py celeryd" + + SHELL +end diff --git a/flowspy/settings.py.patch b/flowspy/settings.py.patch new file mode 100644 index 0000000000000000000000000000000000000000..04737d40819e7ceb37c71946d291db993cb069d0 --- /dev/null +++ b/flowspy/settings.py.patch @@ -0,0 +1,77 @@ +--- flowspy/settings.py.dist 2017-01-10 01:41:37.073048014 +0100 ++++ flowspy/settings.py 2017-01-11 23:02:48.178847119 +0100 +@@ -30,7 +30,7 @@ + djcelery.setup_loader() + from celery.schedules import crontab + +-DEBUG = False ++DEBUG = True + TEMPLATE_DEBUG = DEBUG + + ADMINS = ( +@@ -51,8 +51,8 @@ + + DATABASES = { + 'default': { +- 'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. +- 'NAME': '', ++ 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. ++ 'NAME': 'example-data', + 'USER': '', + 'PASSWORD': '', + 'HOST': '', # Set to empty string for localhost. +@@ -94,7 +94,9 @@ + # If you set this to False, Django will not use timezone-aware datetimes. + USE_TZ = True + +-STATIC_ROOT = os.path.join(BASE_DIR, 'static') ++PROJECT_PATH = os.path.abspath(os.path.dirname(__file__)) ++STATIC_ROOT = os.path.join(BASE_DIR) ++STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static'), ) + STATIC_URL = '/static/' + STATICFILES_FINDERS = ( + 'django.contrib.staticfiles.finders.FileSystemFinder', +@@ -137,7 +139,7 @@ + WSGI_APPLICATION = 'flowspy.wsgi.application' + + AUTHENTICATION_BACKENDS = ( +- 'djangobackends.shibauthBackend.shibauthBackend', ++ #'djangobackends.shibauthBackend.shibauthBackend', + 'django.contrib.auth.backends.ModelBackend', + ) + +@@ -170,25 +172,20 @@ + LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, +- 'filters': { +- 'require_debug_false': { +- '()': 'django.utils.log.RequireDebugFalse' +- } +- }, + 'handlers': { +- 'mail_admins': { +- 'level': 'ERROR', +- 'filters': ['require_debug_false'], +- 'class': 'django.utils.log.AdminEmailHandler' +- } ++ 'file': { ++ 'level': 'DEBUG', ++ 'class': 'logging.FileHandler', ++ 'filename': 'debug.log', ++ }, + }, + 'loggers': { +- 'django.request': { +- 'handlers': ['mail_admins'], +- 'level': 'ERROR', ++ 'django': { ++ 'handlers': ['file'], ++ 'level': 'DEBUG', + 'propagate': True, + }, +- } ++ }, + } + + LOGIN_URL = '/welcome' diff --git a/requirements.txt b/requirements.txt index 50d8bc2f012840112738b85974d5e1b46e71a01d..c98d0311e414e86452c4f756325a8f7a8dbbcb12 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,8 @@ argparse==1.2.1 celery==2.5.3 cl==0.0.3 django-celery==2.5.5 +django-admin==1.0.2 +django-form-utils==1.0.3 django-picklefield==0.2.1 django-registration==0.8 djangorestframework==2.3.14