Upload your files directly from Google drive to Wikimedia Commons. Currently deployed at Toollabs.
We use python 3.5.3
on production. Make sure you have this installed on
your machine, or use pyenv
as described later in this documentation.
The tool authenticates to the Wikimedia cluster using Wikimedia OAuth and to Google using Google OAuth. Hence, we need a couple of secret keys in your local_settings.py
to start development.
SOCIAL_AUTH_MEDIAWIKI_KEY
&SOCIAL_AUTH_MEDIAWIKI_SECRET
: You can request for an OAuth client using Wikimedia:OAuth. Once created, you will get both keys. Remember that you set the right Mediawiki OAuth callback URL.GOOGLE_APP_ID
: We need an application running on Google cloud to authorize and access Google drive. You can create your application at Google cloud console.GOOGLE_APP_ID
is your project id.GOOGLE_CLIENT_ID
: You can create a new OAuth 2.0 Client at Google cloud credentials.GOOGLE_API_DEV_KEY
: You need to enable the Google Picker API on Google cloud console. Once enabled, a dev key is generated, and you can find it on your Google cloud credentials.
For Wikimedia developers, you can find more information on development keys here
- Install pyenv and its virtualenv manager using
This will create a pyenv-virtualenv for you and probably place it on your
$ brew install pyenv $ brew install pyenv-virtualenv $ pyenv install 3.5.3 $ eval "$(pyenv init -)" gdrive_to_commons/$ pyenv virtualenv 3.5.3 gdrive-env-3.5.3
~/home/<username>/.pyenv/versions/
. You can activate that manually usingor even better:gdrive_to_commons/$ source ~/.pyenv/versions/gdrive-env-3.5.3/bin/activate
or, there are better ways to do this if you follow https://github .com/pyenv/pyenv-virtualenvgdrive_to_commons/$ pyenv activate gdrive-env-3.5.3
- Now you are in the right environment, install dependencies using:
(gdrive-env-3.5.3) gdrive_to_commons/$ pip install -r requirements.txt
- We use
pre-commit
hooks to format code. See that you install it using https://pre-commit.com/. Later, install our pre-commit hooks using(gdrive-env-3.5.3) gdrive_to_commons/$ pre-commit install
- There are some
localsettings
you need to have as part of running the server. You can copy a template using:(gdrive-env-3.5.3) gdrive_to_commons/$ cp gdrive_to_commons/local_settings_sample.py gdrive_to_commons/local_settings.py
You need to modify the values there to use the applicaiton in full. - Run the Django standard runserver steps:
or even better, run it from pyCharm using your debugger.
(gdrive-env-3.5.3) gdrive_to_commons/$ python manage.py makemigrations (gdrive-env-3.5.3) gdrive_to_commons/$ python manage.py migrate (gdrive-env-3.5.3) gdrive_to_commons/$ python manage.py collectstatic (gdrive-env-3.5.3) gdrive_to_commons/$ python manage.py runserver localhost:8000