django-rea / rea-project

A way to discuss and collaborate on the django-rea organization umbrella
1 stars 0 forks source link

Upgrading django 1.9 #4

Open XaviP opened 7 years ago

XaviP commented 7 years ago

As pointed here, maybe it's necessary to upgrade django earlier in order to benefit from the new features of 1.9 version in the refactoring (Abstract Base Classes include Foreign Keys, and maybe others).

Workflow (can be easily converted into a script), to check upgradings:

cd [install dir]
git clone https://github.com/django-rea/nrp.git
virtualenv env
cd nrp
source ../env/bin/activate
pip install --upgrade pip setuptools
vim requirements.txt # edit to the desired django version
pip install -r requirements.txt --trusted-host dist.pinaxproject.com
pip install Image
python manage.py check
python manage.py makemigrations
python manage.py migrate
python manage.py test django_rea.valueaccounting.tests
python manage.py createsuperuser
python manage.py runserver

In python manage.py check the errors arise. Studing them and correcting code to finally migrate and pass the tests.

ghost commented 7 years ago

Perhaps we'd use tox.

Here's an example of a tox.ini file of a django project testing everything on many environments.

We would use it to check NRP with the different environments in the travis build.

@XaviP would you like to take a look at it or do you prefer to make changes in the code base but perhaps not those related to the integration builds (I would take a look at tox)?

I don't have experience in tox, but I could help you out, it's a really exciting technology ;) If you take on this task and have any doubts just ping me in telegram and we would even have a Skype call if you have the time.

XaviP commented 7 years ago

First aproach to 1.9 upgrade (edited):

  1. 'url' is not a valid tag or filter in tag library 'future'
grep -rl "{% load url from future %}" ./ | xargs sed -i s@'{% load url from future %}'@''@g
  1. In account/views.py, class LoginView, def get_context_data: ~ctx = kwargs~
ctx = super(LoginView, self).get_context_data(**kwargs)
  1. External package pinax-theme-bootstrap==2.0.4 uses {% load url from future %} in templates. We must upgrade this package to a version that doesn't use it, compatible with dj1.9.

IMPORTANT: django 1.9 in a ssl website requires PyOpenSSL-16.2.0

bhaugen commented 7 years ago

we need to update correctly django_rea/api to last djangorestframework

I'll do that either when the django upgrades are all done, or when anybody needs to use the API for something.

bhaugen commented 7 years ago

In the meantime, @XaviP , great work once again on upgrading django!

XaviP commented 7 years ago
bhaugen commented 7 years ago

What about pinax-theme-bootstrap-account? Do you think we can update to last version in order to have django-appconf updated? Can this break something?

I don't know.

Somebody (was it you or @escanda ) wanted to switch to the supported account app from the version we internalized. Do you intend to do that at the same time? If so, that would break the changes we made to the account app. Some were bug fixes, and some were to get it to work with the work app. We could probably do those some other way. I most likely did the simplest thing that could possibly work.

ghost commented 7 years ago

What about pinax-theme-bootstrap-account? Do you think we can update to last version in order to have django-appconf updated? Can this break something?

It will break stuff :). I'd perhaps create a new branch in which to start committing your changes related to the upgrade and include externalizing the app as well. A first step (to see up to what degree it breaks stuff, could be to rename the account folder to _account). This way it will use the default pinax dependency, and you can start working from there.

I'd create an app under django_rea.auth extending pinax auth. With signals and hooksets I think most of the functionality can be done without modifying the app itself. Also in the usage page they explain some ways to override behavior.

bhaugen commented 7 years ago

@escanda

externalizing the app

I'm for it.

XaviP commented 7 years ago

You can see all these changes in https://github.com/django-rea/nrp/compare/upgrade_django

bhaugen commented 7 years ago

djangorestframework doesn't give errors, but I don't think it works very well.

I wouldn't worry about it yet. We'll need to upgrade to their latest version and then do a makeover. But nobody is using the OCP or DEEP API yet, and I think Chris Troutner was the only user of the original valnet AP, and he cut his own fork: https://github.com/christroutner/valuenetwork

XaviP commented 7 years ago

Two more corrections made and pushed:

XaviP commented 7 years ago

The login form in (anonymous) home doesn't appear. Some info:

Account app is an internalized app from django-user-accounts==1.0b3 https://github.com/pinax/django-user-accounts

ghost commented 7 years ago

Fixed in https://github.com/django-rea/nrp/commit/dffebbb2df3ed0e381360f9e58abbe042ee2a4e7

XaviP commented 7 years ago

External package pinax-theme-bootstrap==2.0.4 uses {% load url from future %} in templates. ~We must upgrade this package to a version that doesn't use it, compatible with dj1.9.~ Not necessary, the system can avoid the use of this package templates.

XaviP commented 7 years ago

IMPORTANT: django 1.9 in a ssl website requires PyOpenSSL-16.2.0