Skip to content

Instantly share code, notes, and snippets.

View singingwolfboy's full-sized avatar
Available for contract work

David Baumgold singingwolfboy

Available for contract work
View GitHub Profile

Hello everyone! The edX team has been hard at work upgrading Open edX to use Django 1.8 instead of 1.4. This change just landed on edx.org, and since things seem to be stable there, we're going to merge the change back to master today. Here's what you need to know.

  • If you are using an Open edX release, this change will NOT affect you until you upgrade to Dogwood. You can stop reading now. (Dogwood will be the next Open edX release after Cypress, and it has not been cut yet.)
  • Django 1.8 does some things differently from Django 1.4. If you are doing any development on the Open edX platform, please review the upgrade release notes that the edX team has put together: https://openedx.atlassian.net/wiki/display/TNL/Django+1.8+Upgrade+Release+Notes
  • The edX team has put a lot of effort into researching the best way to upgrade everyone's devstacks, and has found that the best way forward is to build a new devstack. A new image has been built to support both Django 1.8 and python 2.7.10. Today we will merge Dja
from flask import Flask, redirect, url_for
from flask_dance.contrib.twitter import make_twitter_blueprint, twitter
app = Flask(__name__)
app.secret_key = "supersekrit"
blueprint = make_twitter_blueprint(
api_key="my-key-here",
api_secret="my-secret-here",
)
app.register_blueprint(blueprint, url_prefix="/login")
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
@singingwolfboy
singingwolfboy / gist:5cbe13e305528dae7fc9
Created November 13, 2015 18:45
Modified the Vagrantfile so that configuration points to the `django18-support` branch, and edx-platform points to the `comp-theme-django-18` branch.
% vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'cypress-devstack'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: devstack-theming_default_1447438732078_90326
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
edxapp@precise64:~/edx-platform$ rm -rf /edx/app/edxapp/venvs/edxapp
edxapp@precise64:~/edx-platform$ exit
exit
vagrant@precise64:~$ /edx/bin/update edx-platform django-upgrade/1.8
PLAY [Deploy edxapp] **********************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
@singingwolfboy
singingwolfboy / config
Created September 22, 2015 14:13
Turn off host key checking for edX sandboxes
Host *.sandbox.edx.org sandbox
User singingwolfboy # NOTE: put in YOUR username here
IdentityFile ~/.ssh/github_rsa # NOTE: put in the path to YOUR private key file
StrictHostKeyChecking no
edxapp@precise64:~/edx-platform$ git reset --hard HEAD
HEAD is now at 200adfa A test for optional_include_mako
edxapp@precise64:~/edx-platform$ paver update_assets --debug
---> pavelib.assets.update_assets
---> pavelib.prereqs.install_ruby_prereqs
Ruby prereqs unchanged, skipping...
---> pavelib.prereqs.install_node_prereqs
Node prereqs unchanged, skipping...
python manage.py lms --settings=devstack preprocess_assets lms/static/sass/*.scss lms/static/themed_sass
Finished preprocessing lms assets.
edxapp@precise64:~/edx-platform$ sass --update --cache-location /tmp/sass-cache --default-encoding utf-8 --style compressed --load-path . --load-path common/static --load-path common/static/sass --load-path lms/static/sass --load-path lms/static/themed_sass --load-path cms/static/sass --load-path common/static/sass --load-path lms/static/certificates/sass lms/static/sass:lms/static/css lms/static/themed_sass:lms/static/css cms/static/sass:cms/static/css common/static/sass:common/static/css lms/static/certificates/sass:lms/static/certificates/css
DEPRECATION WARNING on line 50 of lms/static/sass/multicourse/_courses.scss:
Assigning to global variable "$layout-direction" by default is deprecated.
In future versions of Sass, this will create a new local variable.
If you want to assign to the global variable, use "$layout-direction: "RTL" !global" instead.
Note that this will be incompatible with Sass 3.2.
DEPRECATION WARNING on line 221 of lms/static/sass/multicourse/_courses.scss:
Assigning to global variable
@singingwolfboy
singingwolfboy / models.py
Last active August 29, 2015 14:27
How do I make SQLAlchemy understand that when I refer to User.hipchat_group, it should do a join through the one-to-one User.hipchat_user relation?
from datetime import datetime
from sqlalchemy.orm import backref
from hiptweet import db, login_manager
class HipChatGroup(db.Model):
__tablename__ = "hipchat_group"
id = db.Column(db.Integer, primary_key=True)
created_at = db.Column(db.DateTime, default=datetime.utcnow)
% export OPENEDX_RELEASE="named-release/cypress.rc"
[db@dhcp-18-189-94-131:~/devstack-test]
% vagrant destroy
==> default: VM not created. Moving on...
==> default: Removing hosts
==> default: No machine id, nothing removed from /etc/hosts
[db@dhcp-18-189-94-131:~/devstack-test]
% vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'cypress-devstack-rc3' could not be found. Attempting to find and install...