You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org

Help talk:Toolforge/My first Django OAuth tool

From Wikitech-static
< Help talk:Toolforge
Revision as of 08:18, 30 September 2020 by imported>Psemdel
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Venv activate

@BryanDavis: Do you know how to correctly export the environment variables in venv/bin/activate? Locally I am using this service:

[Unit]
Description=uWSGI instance to serve myapp

[Service]
ExecStartPre=-/usr/bin/bash -c 'mkdir -p /run/uwsgi; chown tobias:nginx /run/uwsgi'
ExecStart=/usr/bin/bash -c 'cd /home/tobias/git/my-first-django-oauth-app/src; source /home/tobias/git/venv-my-first-django-oauth-app/bin/activate; uwsgi --ini app.ini'

[Install]
WantedBy=multi-user.target

But on ToolLabs I am not sure how to go through the venv activate step that exports the variables. Currently I just have the keys in the settings.py, but that is not as nice for source control. --Tobias47n9e (talk) 15:44, 12 March 2017 (UTC)

The webservice script will automatically activate a virtual environment by using the --venv argument to uwsgi when the $HOME/www/python/venv directory exists. When you are doing something outside of the webservice script, the easiest way to handle this is with a small shell script that sets up the environment and then uses exec to run the main python script. --BryanDavis (talk) 22:24, 12 March 2017 (UTC)

Goal?

What is the use of Django OAuth tool? Avnerk (talk) 07:28, 27 April 2017 (UTC)

@Avnerk: I think that is better explained at https://www.mediawiki.org/wiki/Help:OAuth - This page is just about one of many technical implementations for a tool that authenticates with Wikipedia (or for any Mediawiki with OAuth extension for that matter). Let me know if that answer was helpful! --Tobias47n9e (talk) 06:50, 15 August 2017 (UTC)

MIDDLEWARE_CLASSES?

Under Adding OAuth, should MIDDLEWARE_CLASSES be changed to MIDDLEWARE? The later is what's used in modern django versions. RoySmith (talk) 01:36, 21 September 2019 (UTC)

Database

A short chapter on how to link Database, I mean other than sqlite, would be nice, as one big advantage of Django is the database management. Psemdel (talk) 13:55, 8 September 2020 (UTC) edit: I gave it a try at user databases. Psemdel (talk) 14:06, 9 September 2020 (UTC)

Uwsgi

In the text, it is written "In the uwsgi.ini file add the following:", but the previous part is for local use. When I look at the code on Github, it is completely different... I would suggest to write, "set the uwsgi.ini as following" and to write the correct one (which I don't know, otherwise I would so it myself). Psemdel (talk) 08:18, 30 September 2020 (UTC)