Add requirements.txt and README instructions for test project setup

Closes #32.
openapi3 1.1.2
Jiri Puc 2018-01-01 19:10:53 +01:00 committed by Cristi Vîjdea
parent faf81e7b6d
commit caa397b906
6 changed files with 42 additions and 11 deletions

View File

@ -36,7 +36,7 @@ You want to contribute some code? Great! Here are a few steps to get you started
$ virtualenv venv $ virtualenv venv
$ source venv/bin/activate $ source venv/bin/activate
(venv) $ pip install -e .[validation] (venv) $ pip install -e .[validation]
(venv) $ pip install -rrequirements/dev.txt -rrequirements/test.txt (venv) $ pip install -rrequirements/dev.txt -rrequirements/test.txt "Django>=1.11.7"
#. **Make your changes and check them against the test project** #. **Make your changes and check them against the test project**
@ -44,7 +44,7 @@ You want to contribute some code? Great! Here are a few steps to get you started
(venv) $ cd testproj (venv) $ cd testproj
(venv) $ python manage.py migrate (venv) $ python manage.py migrate
(venv) $ cat createsuperuser.py | python manage.py shell (venv) $ python manage.py shell -c "import createsuperuser"
(venv) $ python manage.py runserver (venv) $ python manage.py runserver
(venv) $ firefox localhost:8000/swagger/ (venv) $ firefox localhost:8000/swagger/

View File

@ -334,6 +334,26 @@ You can use the specification outputted by this library together with
See the github page linked above for more details. See the github page linked above for more details.
.. _readme-testproj:
6. Example project
==================
For additional usage examples, you can take a look at the test project in the ``testproj`` directory:
.. code:: console
$ git clone https://github.com/axnsan12/drf-yasg.git
$ cd drf-yasg
$ virtualenv venv
$ source venv/bin/activate
(venv) $ cd testproj
(venv) $ pip install -r requirements.txt
(venv) $ python manage.py migrate
(venv) $ python manage.py shell -c "import createsuperuser"
(venv) $ python manage.py runserver
(venv) $ firefox localhost:8000/swagger/
********** **********
Background Background
********** **********

View File

@ -6,10 +6,4 @@ pytest-cov>=2.5.1
git+https://github.com/pytest-dev/pytest-django.git@94cccb956435dd7a719606744ee7608397e1eafb git+https://github.com/pytest-dev/pytest-django.git@94cccb956435dd7a719606744ee7608397e1eafb
datadiff==2.0.0 datadiff==2.0.0
# test project requirements -r testproj.txt
Pillow>=4.3.0
pygments>=2.2.0
django-cors-headers>=2.1.0
django-filter>=1.1.0,<2.0; python_version == "2.7"
django-filter>=1.1.0; python_version >= "3.4"
djangorestframework-camel-case>=0.2.0

View File

@ -0,0 +1,7 @@
# test project requirements
Pillow>=4.3.0
pygments>=2.2.0
django-cors-headers>=2.1.0
django-filter>=1.1.0,<2.0; python_version == "2.7"
django-filter>=1.1.0; python_version >= "3.4"
djangorestframework-camel-case>=0.2.0

View File

@ -1,4 +1,11 @@
from __future__ import print_function
from django.contrib.auth.models import User from django.contrib.auth.models import User
User.objects.filter(username='admin').delete() username = 'admin'
User.objects.create_superuser('admin', 'admin@admin.admin', 'passwordadmin') email = 'admin@admin.admin'
password = 'passwordadmin'
User.objects.filter(username=username).delete()
User.objects.create_superuser(username, email, password)
print("Created superuser '%s <%s>' with password '%s'" % (username, email, password))

View File

@ -0,0 +1,3 @@
drf-yasg[validation]
Django>=1.11.7
-r ../requirements/testproj.txt