tox -e manage -- collectstatic failed to collect MySQL-python

Bug #1737242 reported by Mudassar Hashmi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Low
Akihiro Motoki

Bug Description

Tox worked fine before I installed MySQL-Python library but now when I collect statics I get this error on Github Gists:

https://gist.github.com/anonymous/3ee68522c937bf09204c3043f9972e11

Can someone point me to right direction to fix this?

Revision history for this message
Akihiro Motoki (amotoki) wrote :

Could you provide more information?

- Where and how did you install MySQL-Python?
- What is your settings? Do you specify some DB backend setting?

Revision history for this message
Akihiro Motoki (amotoki) wrote :

tox prepares a new virtualenv.
If you configure db backend as session backend, you might need to install some python mysql binding into the virtualenv.

 tox -e manage --notest
 .tox/manage/bin/pip install MySQL-Python (<--- I am not sure this is the right python mysql binding module though)
 tox -e manage -- collectstatic

Or, if you install horizon into your system globally, you can just run:

 cd <horizon dir>
 python manage.py collectstatic

Revision history for this message
Mudassar Hashmi (mhashmi1979) wrote :

I installed MySQL-Python with pip and also tried installing with apt install python-mysqldb. The strange thing is that it required libmysqlclient while I was migrating with "python manage.py migrate". Its been a while I am trying to configure Horizon to customize default layout of Horizon Dashbaord before I implement it to production. "tox -e manage -- collectstatic" is the requirement for collecting edited static from customized theme that is why I even installed horizon with multiple times to test but in vain.

Also I am not using virtualenv its a global installation on a Ubuntu 16.04 virtual machine. Do you think "python manage.py collectstatic" will produce same results as I've read in few posts that tox collects static to generate its own css for development. If "python manage.py collectstatic" can produce same results than I can keep using that.

Thanks for your reply and further assistance will be much appreciated.

Revision history for this message
Akihiro Motoki (amotoki) wrote :

Ah, I see. In this case, "python manage.py collectstatic" (or compress) needs to be used.
"tox -e manage -- collectstatic" is prepared to provide a convenient way with no configuration, but 'tox' creates a virtualenv internally and use the created virtualenv to run manage.py collectstatic. In the new created virtualenv, python-mysqldb is not installed but your settings assumes mysql is used. This is the reason of the failure.

I have one question. which document did you refer to?
We might need to modify some document.

Revision history for this message
Mudassar Hashmi (mhashmi1979) wrote :

The objective is to create a customized theme on development server where I cloned Horizon from github. Once I tested everything than I can implement it in production. The following is the link from official docs I am following:

https://docs.openstack.org/horizon/latest/configuration/themes.html

Revision history for this message
Mudassar Hashmi (mhashmi1979) wrote :

However, I am not working with "virtualenv" library. Horizon is globally installed so I can work with customizing openstack-dashboard. If somehow it does creates a virtualenv by default with tox I am not aware of it and would be thankful if you help me understand the fix for it.
Thanks

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/527121

Changed in horizon:
assignee: nobody → Akihiro Motoki (amotoki)
status: New → In Progress
Akihiro Motoki (amotoki)
Changed in horizon:
importance: Undecided → Low
milestone: none → queens-3
Ying Zuo (yingzuo)
Changed in horizon:
milestone: queens-3 → queens-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/527121
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=a57d8b0e15cf432d3ac2be0dee1f07519188b173
Submitter: Zuul
Branch: master

commit a57d8b0e15cf432d3ac2be0dee1f07519188b173
Author: Akihiro Motoki <email address hidden>
Date: Tue Dec 12 00:14:23 2017 +0900

    doc: use "python manage.py" directly rather "tox -e manage"

    According to bug 1737242, tox -e manage collectstatic/compress
    can fail with a customized settings file (for example, a setting
    which uses db backend for caching). After discussion with the bug
    reporter, he develops a theme using a production settings file
    and runs into a trouble. It looks better to use python manage.py
    directly to avoid further confusion.

    Change-Id: If34ba249745a110268cc99213cc404697b03495f
    Closes-Bug: #1737242

Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 13.0.0.0rc1

This issue was fixed in the openstack/horizon 13.0.0.0rc1 release candidate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.