Project

Profile

Help

Pulp 3 Developer Notes » History » Sprint/Milestone 1

semyers, 03/30/2017 11:43 PM
Content!

1 1 semyers
# Pulp 3 Developer Notes
2
3
This wiki page is intended for use during early development of Pulp 3. Over time, as our development practices become standard, the contents of this page should be moved into the [Pulp Contributing Guide](https://docs.pulpproject.org/en/3.0/nightly/contributing/index.html)
4
5
## Virtualenv installation issues
6
7
From time to time, I've (smyers) run into issues with the Platform components not being properly installed in the "pulp" virtualenv in vagrant on 3.0-dev. My fix for this is to run this command in the pulp repository root directory with the "pulp" virtualenv activated:
8
9
~~~
10
for dir in app/ common/ exceptions/ tasking/ plugin/; do pushd $dir; python setup.py develop; popd; done
11
~~~
12
13
I'm not sure what's causing this, but assume that the virtualenvs have some PYTHONPATH issue that prevents them from "seeing" the installed libs, or possibly there's just something missing from the dev playbook that sets all that up.
14
15
Similarly if you want to test any plugins in the platform API, they need to be installed into the "pulp" virtualenv the same way, by running `python setup.py develop` on the plugin's setup.py.
16
17
## Migrations
18
19
In both platform and plugins, the data model is not complete. As a result, committing migrations to the 3.0-dev branch will result in merge/migration conflicts from pull request to pull request. The simplest solution for now is not to commit migrations to the repository.
20
21
Because User model depends on Django's auth app having been migrated, this means that you currently need to run `python manage.py migrate auth` before running a general `python manage.py migrate` to set up the pulp database.
22
23
### Making migrations during development
24
25
Tests require migrations to run, so while we should not *commit* migrations to the repositories just yet, we do still need to *make* them. This can be done with the `python manage.py makemigrations` command. Apps that depend on the platform migrations existing (such as plugins) may cause errors when making migrations. To avoid these errors, platform migrations should be made prior to installing any plugins.
26
27
Once the initial migrations are created, and model changes made thereafter will require `python manage.py makemigrations` to be run again, following by @python manage.py migrate" so Django can apply the model changes to the database.
28
29
This is probably something we can do in the dev playbook; automating the process until we do start to commit migrations would help immensely with mitigating this annoyance.
30
31
## Starting a Web Server
32
33
The Django development server can be started with `python manage.py runserver`. This will run a basic WSGI app that exposes the URLs routed in `urls.py`, allowing you to access the REST API.
34
35
If you're using the vagrant [hostmanager](https://rubygems.org/gems/vagrant-hostmanager) plugin, you can easily access the API from the host machine by explicitly binding the web server to all interfaces, e.g. `python manage.py runserver 0.0.0.0:8000`. This should make the API browseable at http://dev.example.com:8000/api/v3/
36
37
### Authentication
38
39
We currently enable Basic HTTP Authentication on the REST API. This can be temporarily disabled by commenting out the `DEFAULT_PERMISSION_CLASSES` line in the `REST_FRAMEWORK` section in `app/pulp/app/settings.py`. Note that this doesn't disable authentication, it just authorizes unauthenticated users to take any action. Basic Authentication should still work.