|François Poulain 1b86fcd78d|
Convertisseur Drupal 6 vers SPIP pour le site web libre à lire
Table of content
Give a try
On a Debian-based host - running at least Debian Stretch:
$ sudo apt install python3 virtualenv git make $ git clone https://forge.april.org/siteweb/drupal2spip_lal $ cd drupal2spip_lal/ $ make init
A configuration will be created interactively; uncomment
$ make inspectdb $ make check $ venv/bin/python manage.py import --help
On a Debian-based host - running at least Debian Stretch, you will need the following packages:
- git (recommended for getting the source)
- python3-mysqldb (optional, in case of a MySQL / MariaDB database)
- python3-psycopg2 (optional, in case of a PostgreSQL database)
It assumes that you already have the application source code locally - the best way is by cloning this repository - and that you are in this folder.
Define your local configuration in a file named
config.env, which can be copied from
config.env.exampleand edited to suits your needs.
Depending on your environment, you will have to create your database and the user at first.
Note that if there is no
config.envfile, it will be created interactively.
That's it! Your environment is now initialized with the application installed.
To update it, once the source code is checked out, simply run
You can also check that your application is well configured by running
If you don't want to use the
Makefile facilities, here is what is done behind the scene.
It assumes that you have downloaded the last release of drupal2spip_lal, extracted it and that you moved to that folder.
Start by creating a new virtual environment under
./venvand activate it:
$ virtualenv --system-site-packages ./venv $ source ./venv/bin/activate
Install the required Python packages depending on your environment:
$ pip install -r requirements/production.txt ... or ... $ pip install -r requirements/development.txt
Configure the application by setting the proper environment variables depending on your environment. You can use the
config.env.examplewhich give you the main variables with example values.
$ cp config.env.example config.env $ nano config.env $ chmod go-rwx config.env
Note that this
./config.envfile will be loaded by default when the application starts. If you don't want that, just move this file away or set the
READ_CONFIG_FILEenvironment variable to
Create the database tables - it assumes that you have created the database and set the proper configuration to use it:
$ ./manage.py migrate
All the application files - e.g. Django code including settings, templates and
statics - are located into
Two environments are defined - either for requirements and settings:
development: for local application development and testing. It uses a SQLite3 database and enable debugging by default, add some useful settings and applications for development purpose - i.e. the
production: for production. It checks that configuration is set and correct, try to optimize performances and enforce some settings - i.e. HTTPS related ones.
You can override and extend statics and templates locally. This can be useful
if you have to change the logo for a specific instance for example. For that,
just put your files under the
Regarding the statics, do not forget to collect them after that. Note also that
local/ folder is ignored by git.
All the variable content - e.g. user-uploaded media, collected statics - are
stored inside the
var/ folder. It is also ignored by git as it's specific
to each application installation.
So, you will have to configure your Web server to serve the
var/static/ folders, which should point to
The easiest way to deploy a development environment is by using the
make init, ensure that you have either set
config.env file or have this environment variable. Note that you can
still change this variable later and run
make init again.
There is some additional rules when developing, which are mainly wrappers for
manage.py. You can list all of them by running
make help. Here are the main ones:
make serve: run a development server
make test: test the whole application
make lint: check the Python code syntax
drupal2spip_lal is developed by François Poulain (April) and licensed under the AGPLv3+. Its basis comes from https://forge.cliss21.org/cliss21/cookiecutter-django/