Skip to content

monkeybits/edilcloud-back

Repository files navigation

whistle 2017

Clone the respository

hg clone ssh://hg@bitbucket.org/thux/edilcloud-back

Use Virtualenv and Virtualenvwrapper

The virtualenv, put simply, is an isolated working copy of Python which allows you to work on a specific project without worry of affecting other projects. It enables multiple side-by-side installations of Python, one for each project. It doesn’t actually install separate copies of Python, but it does provide a clever way to keep different project environments isolated.

Virtualenvwrapper is a set of extensions to virtualenv. It gives you commands like mkvirtualenv, lssitepackages, and especially workon for switching between different virtualenv directories. This tool is especially useful if you want multiple virtualenv directories.

Installation

pip install --user virtualenv virtualenvwrapper

Configuration

Add three lines to your shell startup file (.bashrc, .profile, etc.) to set the location where the virtual environments should live, the location of your development project directories, and the location of the script installed with this package:

export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Workspace
source /usr/local/bin/virtualenvwrapper.sh

Create and activate the virtual environment

####Create virtualenv:

  • virtualenv (standard):

    • python2:

      virtualenv edilcloud-back/venv

    • python3:

      virtualenv edilcloud-back/venv --python /usr/bin/python3

  • virtualenvwrapper:

    • python2:

      mkvirtualenv edilcloud-back

    • python3:

      mkvirtualenv --python=/usr/bin/python3 edilcloud-back

  • Python3 Venv (only for python 3):

    python3 -m venv edilcloud-back/venv

####Activate virtualenv:

  • virtualenv (standard) & Python3 Venv (only for python 3):

    . venv/bin/activate

  • virtualenvwrapper: workon edilcloud-back

Install and configure autoenv

Cookiecutter prepare automatically .env file, but is necessary install the global package

sudo pip install autoenv

and configure your .bashrc:

echo "source `which activate.sh`" >> ~/.bashrc

For create autoenv in your project (in this example with virtualenvwrapper) create .env file as follows:

echo "workon edilcloud-back" > .env

The complete autoenv documentation can be found here.

Configure pip for Thux pypi

Any package are developed internal in Thux, to automataically check correct repo cretate .pip/pip.conf:

[global]
find-links = https://pypi.thux.it/

Install the requirements

pip install .

Create the database

createdb edilcloud-back

Create local.py file inside web/settings

gedit web/settings/local.py

Copy the following settings into the local.py file

#!python

# -*- coding: utf-8 -*-
SECRET_KEY = 'Place your brand new security key here'
DEBUG = True
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'edilcloud-back',
        'USER': '',
        'PASSWORD': '',
        'HOST': '',
        'PORT': '',
    }
}

EMAIL_HOST = ''
EMAIL_PORT = ''
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = True
EMAIL_SUBJECT_PREFIX = ['whistle']
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

Apply Migrations

dj migrate

Create admin account

dj createsuperuser

Create static folder inside web dir

cd edilcloud-back/web
mkdir static

Run django server

dj r

Have fun!

scripts

TYPOLOGY, CATEGORY, SUBCATEGORY, ECC

  • python manage.py shell < web/management/scripts/import_typology.py
  • python manage.py shell < web/management/scripts/import_category.py

DEV ssh -i "Edilcloud-key.pem" ec2-user@35.178.108.7

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published