Giter Club home page Giter Club logo

gdrive-to-commons's Introduction

Google drive to Wikimedia Commons

Build Status

Upload your files directly from Google drive to Wikimedia Commons. Currently deployed at Toollabs.

Dependencies

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.

Pre-requisites for local development

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.

  1. 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.
  2. 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.
  3. GOOGLE_CLIENT_ID: You can create a new OAuth 2.0 Client at Google cloud credentials.
  4. 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

Steps for local development

  1. Install pyenv and its virtualenv manager using
    $ 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
    
    This will create a pyenv-virtualenv for you and probably place it on your ~/home/<username>/.pyenv/versions/. You can activate that manually using
    gdrive_to_commons/$ source ~/.pyenv/versions/gdrive-env-3.5.3/bin/activate
    
    or even better:
    gdrive_to_commons/$ pyenv activate gdrive-env-3.5.3
    
    or, there are better ways to do this if you follow https://github .com/pyenv/pyenv-virtualenv
  2. Now you are in the right environment, install dependencies using:
    (gdrive-env-3.5.3) gdrive_to_commons/$ pip install -r requirements.txt
    
  3. 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
  4. 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.
  5. Run the Django standard runserver steps:
    (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
    
    or even better, run it from pyCharm using your debugger.

gdrive-to-commons's People

Contributors

srish avatar tonythomas01 avatar shcherbadev avatar dependabot[bot] avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.