2018-06-24 05:12:46 +10:00
|
|
|
.. _standalone_installation:
|
|
|
|
|
|
|
|
==============================================
|
|
|
|
Standalone Installation (or local development)
|
|
|
|
==============================================
|
|
|
|
|
|
|
|
.. important:: This documentation describes the installation of dpaste
|
|
|
|
as a standalone project, primarily for local development. If you want
|
|
|
|
to integrate the application into your existing Django project, see
|
|
|
|
:ref:`project_installation`.
|
|
|
|
|
2019-12-07 21:37:30 +11:00
|
|
|
The project uses Docker for local development. Start it with:
|
2018-06-24 05:12:46 +10:00
|
|
|
|
|
|
|
.. code:: bash
|
|
|
|
|
2019-12-07 21:37:30 +11:00
|
|
|
$ make up
|
2018-06-24 05:12:46 +10:00
|
|
|
|
2019-12-07 21:37:30 +11:00
|
|
|
Or if you're more familiar with docker-compose
|
2018-06-24 05:12:46 +10:00
|
|
|
|
2019-12-07 21:37:30 +11:00
|
|
|
.. code:: bash
|
2018-06-24 05:12:46 +10:00
|
|
|
|
2019-12-07 21:37:30 +11:00
|
|
|
$ docker-compose run --rm app ./manage.py migrate
|
|
|
|
$ docker-compose up
|
2018-06-24 05:12:46 +10:00
|
|
|
|
2019-12-07 21:37:30 +11:00
|
|
|
This will open the Django runserver on http://127.0.0.1:8000. Changes to the
|
|
|
|
code are automatically reflected in the Docker container and the runserver
|
|
|
|
will reload automatically.
|
2018-06-24 05:12:46 +10:00
|
|
|
|
2019-12-07 21:37:30 +11:00
|
|
|
Local development using virtualenv
|
|
|
|
==================================
|
2018-06-24 05:12:46 +10:00
|
|
|
|
2019-12-07 21:37:30 +11:00
|
|
|
If you prefer the classic local installation using Virtualenv then you can
|
|
|
|
do so. There's nothing magic involved:
|
2018-06-24 05:12:46 +10:00
|
|
|
|
2019-12-07 21:37:30 +11:00
|
|
|
.. code:: bash
|
2018-06-24 05:12:46 +10:00
|
|
|
|
2019-12-07 21:37:30 +11:00
|
|
|
$ python3 -m venv .venv
|
|
|
|
$ source .venv/bin/activate
|
|
|
|
$ pip install -e .[dev]
|
2018-06-24 05:12:46 +10:00
|
|
|
|
2019-12-07 21:37:30 +11:00
|
|
|
CSS and Javascript development
|
|
|
|
==============================
|
2018-06-24 05:12:46 +10:00
|
|
|
|
2019-12-07 21:37:30 +11:00
|
|
|
Both [S]CSS and Javascript files need to be compiled and compressed.
|
2018-06-24 05:12:46 +10:00
|
|
|
|
2019-12-07 21:37:30 +11:00
|
|
|
Install the necessary node dependencies first:
|
2018-06-24 05:12:46 +10:00
|
|
|
|
2019-12-07 21:37:30 +11:00
|
|
|
.. code:: bash
|
2018-06-24 05:12:46 +10:00
|
|
|
|
2019-12-07 21:37:30 +11:00
|
|
|
$ npm install
|
2018-06-24 05:12:46 +10:00
|
|
|
|
2019-12-07 21:37:30 +11:00
|
|
|
There are some helper scripts you can invoke with ``make``
|
2018-06-24 05:12:46 +10:00
|
|
|
|
2019-12-07 21:37:30 +11:00
|
|
|
``npm js``
|
2018-06-24 05:12:46 +10:00
|
|
|
Compile only JS files.
|
2019-12-07 21:37:30 +11:00
|
|
|
``npm css``
|
2018-06-24 05:12:46 +10:00
|
|
|
Compile only CSS files.
|
2019-12-07 21:37:30 +11:00
|
|
|
``make css-watch``
|
2018-06-24 05:12:46 +10:00
|
|
|
Same as ``build-css`` but it automatically watches for changes in the
|
|
|
|
CSS files and re-compiles it.
|
2019-12-07 21:37:30 +11:00
|
|
|
``make docs``
|
2018-06-24 05:12:46 +10:00
|
|
|
Compile this documentation. The result will be in ``docs/_build/html``.
|
2019-12-07 21:37:30 +11:00
|
|
|
``make docs-watch``
|
2018-06-24 05:12:46 +10:00
|
|
|
Same as ``docs`` but it automatically watches for changes in the
|
|
|
|
documentation files and re-compiles the docs.
|
|
|
|
|
2019-12-07 21:37:30 +11:00
|
|
|
.. note:: See ``make help`` for the full and most recent list of
|
2018-06-24 05:12:46 +10:00
|
|
|
helper scripts.
|
|
|
|
|
|
|
|
Testing with Tox
|
|
|
|
================
|
|
|
|
|
|
|
|
dpaste is continuously tested online with Travis_. You can also run the test
|
|
|
|
suite locally with tox_. Tox automatically tests the project against multiple
|
|
|
|
Python and Django versions.
|
|
|
|
|
|
|
|
Similar to ``pipenv`` it's useful to have tox installed globally:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
$ pip install tox
|
|
|
|
|
|
|
|
Then simply call it from the project directory.
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
$ cd dpaste/
|
|
|
|
$ tox
|
|
|
|
|
|
|
|
.. code-block:: text
|
|
|
|
:caption: Example tox output:
|
|
|
|
|
|
|
|
$ tox
|
|
|
|
|
|
|
|
py35-django-111 create: /tmp/tox/dpaste/py35-django-111
|
|
|
|
SKIPPED:InterpreterNotFound: python3.5
|
|
|
|
py36-django-111 create: /tmp/tox/dpaste/py36-django-111
|
|
|
|
py36-django-111 installdeps: django>=1.11,<1.12
|
|
|
|
py36-django-111 inst: /tmp/tox/dpaste/dist/dpaste-3.0a1.zip
|
|
|
|
|
|
|
|
...................
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
Ran 48 tests in 1.724s
|
|
|
|
OK
|
|
|
|
|
|
|
|
|
|
|
|
SKIPPED: py35-django-111: InterpreterNotFound: python3.5
|
|
|
|
SKIPPED: py35-django-20: InterpreterNotFound: python3.5
|
|
|
|
py36-django-111: commands succeeded
|
|
|
|
py36-django-20: commands succeeded
|
|
|
|
congratulations :)
|
|
|
|
|
|
|
|
.. _Travis: https://travis-ci.org/bartTC/dpaste
|
|
|
|
.. _tox: http://tox.readthedocs.org/en/latest/
|