-
Notifications
You must be signed in to change notification settings - Fork 219
Development Environment Setup
- Go to https://www.jetbrains.com/idea/download/#section=windows, download latest IntelliJ IDEA and install it
- Go to https://www.python.org/downloads/, download latest Python version and install it (incl. pip)
- Go to https://git-scm.com/downloads, download latest GIT version and install it
- Add path to Python and pip to User variables --> PATH (This allows you to access both from everywhere in the command line tool)
- E.g. C:\Python\Python36-32\ (for Python)
- E.g. C:\Python\Python36-32\Scripts\ (for pip)
- Start IntelliJ open Configure --> Settings
- Version Control --> Git --> Point 'Path to Git executable' to the Git installation directory (git.exe)
- Plugins --> Browse repositories... --> search for Python and install it
- Editor --> General --> Auto Import --> Python --> select 'Show import popup' and 'from import '
- Close Settings and check out koalixCRM from GitHub:
- Click on Check out from Version Control --> GitHub (do not import repository it direcectly when you asked to do it)
- Click on Import Project --> choose root directory of checked out project --> OK --> Create project from existing sources --> Next --> Next --> Next --> choose Python SDK (python.exe) from the Python installation target directory --> Next --> select Django framework --> Finish
- Connect to SQLite Database
- Open 'Database' tool window: Go to View --> Tool Windows --> Database
- Connect to SQLite DB from the opened database tool window: Click green plus icon --> Data Source --> Sqlite (Xerial) and enter path to db.sqlite3 file in te input field 'File'. This file will be generated at the following path: <>/sandbox/db.sqlite3
- Run koalixCRM locally by execution of the folling commands in the IntelliJ terminal
- pip install -r requirements.txt
- python setup.py install
- python manage.py collectstatic --noinput
- python manage.py makemigrations
- python manage.py migrate
- python manage.py createsuperuser (you will be asked to set credentials for the new administator user for koalixCRM)
- python manage.py runserver
- Open koalixCRM (http://127.0.0.1:8000/admin) in the web browser
The continious build is realized with Travis CI (https://travis-ci.org/). GitHub provides an app in the Marketplace to set up the connection between GitHub and Travis. Travis builds can be configured by .travis.yml file which has to be located in the root directory of your project.
- Add Travis to your GitHub account.
- Log in to your GitHub account.
- Go to Marketplace (accessible from the header menu bar).
- Search for Travis CI app and install the open source version.
- Create a Travis build job for your desired repository
- Go to https://travis-ci.org/ sign in with GitHub
- In the left side bar, you can see the already added repository to Travis services. Click on '+'-icon and enable the repository which you want to build with Travis in the list of repositories (toggle button).
- Go back to the previous page. Here you should see now the new repository you've added in the left side bar. The job isn't running yet since this is triggered by the commits on your repository.
- Create configuration file for Travis builds Travis builds require a configuration file '.travis.yml' in the root directory of your project. KoalixCrm already has this configuration file included in the project. If you want to set up a new project with Travis CI build you have to create this file.
To get the Travis build running, the following minimum configuration has to be defined:
language: python
python:
- '3.4'
install: pip install -r requirements.txt
script: pytest
For further information about the configuration of Travis, have a look at the Travis documentation page: https://docs.travis-ci.com/user/customizing-the-build/
Travis has to set up an connection to Heroku to be able to deploy the application.
- Get Heroku API Key
- Login to your Heroku account
- Go to Account settings, scroll down to 'API Key' and click 'Reveal' --> Your API Key will be displayed
- Copy this API Key to your clipboard
- Configure Heroku API Key in Travis
- Login to your Travis account
- Select the repository which you want to deploy on Heroku
- Go to More options --> Settings, scroll down to 'Environment Variables' and add a new variable with:
- Name: HEROKU_API_KEY
- Value: the Heroku API Key from step 1
- Display value in build log: disabled
The deployment of the application has to be configured in .travis.yml file too. For koalixCRM the following code has to be added to .travis.yml:
deploy:
provider: heroku
api_key:
secure: $HEROKU_API_KEY
app: koalix-crm
on:
repo: scaphilo/koalixcrm
Explanations:
- provider: Defines the target provider name where you want to deploy the application
- api_key: Is defined by the placeholder $HEROKU_API_KEY. The key will be replaced by the environment variable which is set in the Travis repository settings (see chapter 'Connect Travis to Heroku').
- app: Defines the name of the project on Heroku
- repo: Defines the repository where the application code is located.