Обсуждение: [pgadmin-hackers][pgaweb][patch] Website patch to add SCSS

Поиск
Список
Период
Сортировка

[pgadmin-hackers][pgaweb][patch] Website patch to add SCSS

От
Joao De Almeida Pereira
Дата:
Hi Hackers,

In this email you will be able to find the first patches to start the migration of the Styleguide from http://pgadmin4-styleguide.cfapps.io/ to the pgadmin.org webpage.

The first patch adds a Readme to the project and also the yarn.lock file
The second patch:
- Adds SCSS processor to Django
- Scripts to yarn to compile the SCSS and run the application
- Add startapp.sh script to start the application
- Changes the current pgaweb.css file to SCSS
- Update README with new instructions


Thanks
Joao
Вложения

Re: [pgadmin-hackers][pgaweb][patch] Website patch to add SCSS

От
Dave Page
Дата:
Hi

On Mon, Jul 10, 2017 at 7:16 PM, Joao De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:
Hi Hackers,

In this email you will be able to find the first patches to start the migration of the Styleguide from http://pgadmin4-styleguide.cfapps.io/ to the pgadmin.org webpage.

The first patch adds a Readme to the project and also the yarn.lock file
The second patch:
- Adds SCSS processor to Django

Hmm, seems like the dependencies are broken. Adding them throws me down what seems like a rabbit hole of manual installation, starting with:

(pgaweb) piranha:pgaweb dpage$ pip install -r requirements.txt 
Requirement already satisfied: Django==1.8.18 in /Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages (from -r requirements.txt (line 1))
Requirement already satisfied: psycopg2==2.7.1 in /Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages (from -r requirements.txt (line 2))
Collecting libsass==0.13.2 (from -r requirements.txt (line 3))
  Using cached libsass-0.13.2.tar.gz
Could not import setuptools which is required to install from a source distribution.
Traceback (most recent call last):
  File "/Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages/pip/req/req_install.py", line 387, in setup_py
    import setuptools  # noqa
  File "/Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages/setuptools/__init__.py", line 10, in <module>
    from six.moves import filter, map
ImportError: No module named six.moves

Perhaps the entire dependency tree should be added to requirements.txt?
 
- Scripts to yarn to compile the SCSS and run the application 
- Add startapp.sh script to start the application

The application runs under uWSGI - it's not going to be started via a script. It's auto-updated periodically from git, and uWSGI will restart when necessary so if any pre-processing of files is required, that needs to be done at startup automatically.
 
- Changes the current pgaweb.css file to SCSS

OK.
 
- Update README with new instructions

- The "Add initial pgAdmin4 version" should be changed to describe loading the fixture data from each of the various modules that seed the database. e.g.

./manage.py loaddata ./download/fixtures/packages.json
./manage.py loaddata ./download/fixtures/distributions.json
./manage.py loaddata ./download/fixtures/versions.json
./manage.py loaddata ./download/fixtures/downloads.json
./manage.py loaddata ./faq/fixtures/categories.json
./manage.py loaddata ./faq/fixtures/faqs.json
./manage.py loaddata ./news/fixtures/news.json
./manage.py loaddata ./versions/fixtures/versions.json

- s/PGAdmin/pgAdmin

- We can remove the part about using sqlite for the DB. This is a Postgres project after all :-)

Thanks.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: [pgadmin-hackers][pgaweb][patch] Website patch to add SCSS

От
George Gelashvili
Дата:
Hi Dave,
 
Hmm, seems like the dependencies are broken. Adding them throws me down what seems like a rabbit hole of manual installation, starting with:

(pgaweb) piranha:pgaweb dpage$ pip install -r requirements.txt 
Requirement already satisfied: Django==1.8.18 in /Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages (from -r requirements.txt (line 1))
Requirement already satisfied: psycopg2==2.7.1 in /Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages (from -r requirements.txt (line 2))
Collecting libsass==0.13.2 (from -r requirements.txt (line 3))
  Using cached libsass-0.13.2.tar.gz
Could not import setuptools which is required to install from a source distribution.
Traceback (most recent call last):
  File "/Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages/pip/req/req_install.py", line 387, in setup_py
    import setuptools  # noqa
  File "/Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages/setuptools/__init__.py", line 10, in <module>
    from six.moves import filter, map
ImportError: No module named six.moves

Perhaps the entire dependency tree should be added to requirements.txt?
 

What version of pip runs in your pyenv? We're able to pip install requirements inside a new 2.7.10 virtualenv, that gets created with pip 9.0.1 by default.
 
- Scripts to yarn to compile the SCSS and run the application 
- Add startapp.sh script to start the application

The application runs under uWSGI - it's not going to be started via a script. It's auto-updated periodically from git, and uWSGI will restart when necessary so if any pre-processing of files is required, that needs to be done at startup automatically.

Okay, so it sounds like shelling out to yarn in wsgi would resolve this. Otherwise, what does the auto-update process look like? perhaps compilation steps belong there rather than in app startup. Also, unless a restart needs to pick up changes separately from those checked into the repo, the app should be able to restart with static pre-compiled resources.
 
- The "Add initial pgAdmin4 version" should be changed to describe loading the fixture data from each of the various modules that seed the database. e.g.

./manage.py loaddata ./download/fixtures/packages.json
./manage.py loaddata ./download/fixtures/distributions.json
./manage.py loaddata ./download/fixtures/versions.json
./manage.py loaddata ./download/fixtures/downloads.json
./manage.py loaddata ./faq/fixtures/categories.json
./manage.py loaddata ./faq/fixtures/faqs.json
./manage.py loaddata ./news/fixtures/news.json
./manage.py loaddata ./versions/fixtures/versions.json 
 
- s/PGAdmin/pgAdmin

- We can remove the part about using sqlite for the DB. This is a Postgres project after all :-)

Changed.

Thanks,
George and Shruti
Вложения

Re: [pgadmin-hackers][pgaweb][patch] Website patch to add SCSS

От
Dave Page
Дата:


On Wed, Jul 12, 2017 at 9:27 PM, George Gelashvili <ggelashvili@pivotal.io> wrote:
Hi Dave,
 
Hmm, seems like the dependencies are broken. Adding them throws me down what seems like a rabbit hole of manual installation, starting with:

(pgaweb) piranha:pgaweb dpage$ pip install -r requirements.txt 
Requirement already satisfied: Django==1.8.18 in /Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages (from -r requirements.txt (line 1))
Requirement already satisfied: psycopg2==2.7.1 in /Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages (from -r requirements.txt (line 2))
Collecting libsass==0.13.2 (from -r requirements.txt (line 3))
  Using cached libsass-0.13.2.tar.gz
Could not import setuptools which is required to install from a source distribution.
Traceback (most recent call last):
  File "/Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages/pip/req/req_install.py", line 387, in setup_py
    import setuptools  # noqa
  File "/Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages/setuptools/__init__.py", line 10, in <module>
    from six.moves import filter, map
ImportError: No module named six.moves

Perhaps the entire dependency tree should be added to requirements.txt?
 

What version of pip runs in your pyenv? We're able to pip install requirements inside a new 2.7.10 virtualenv, that gets created with pip 9.0.1 by default.

Apologies - my virtual env was messed up.
 
 
- Scripts to yarn to compile the SCSS and run the application 
- Add startapp.sh script to start the application

The application runs under uWSGI - it's not going to be started via a script. It's auto-updated periodically from git, and uWSGI will restart when necessary so if any pre-processing of files is required, that needs to be done at startup automatically.

Okay, so it sounds like shelling out to yarn in wsgi would resolve this.

I think your suggestion below would be cleaner.

 
Otherwise, what does the auto-update process look like? perhaps compilation steps belong there rather than in app startup.

It's really just a GIT pull. uWSGI then detects the change and restarts that app. We could certainly have it do "git pull && yarn install && yarn run scss" or similar.

Now that said, the scss doesn't actually seem to build for me. I had to make 2 changes to get anywhere:

1) Change the tag in base.html to:

<link href="{% sass_src 'css/pgaweb.scss' %}" rel="stylesheet" type="text/css" />

2) Remove the STATIC_ROOT directive from settings.py (so it didn't try to compile to /static) and replace with COMPRESS_ROOT='static/' and SASS_PROCESSOR_ROOT='static/'.

That left me with a running site, that seems to behave as expected, at least when run standalone.

Patch attached - comments?

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Вложения

Re: [pgadmin-hackers][pgaweb][patch] Website patch to add SCSS

От
Joao De Almeida Pereira
Дата:
Hello Dave,
Instead of using the current library we found another one that compiles the SCSS when the application starts.
We recreated the patches we sent before.

Thanks
Joao & Sarah

On Fri, Jul 14, 2017 at 5:42 AM, Dave Page <dpage@pgadmin.org> wrote:


On Wed, Jul 12, 2017 at 9:27 PM, George Gelashvili <ggelashvili@pivotal.io> wrote:
Hi Dave,
 
Hmm, seems like the dependencies are broken. Adding them throws me down what seems like a rabbit hole of manual installation, starting with:

(pgaweb) piranha:pgaweb dpage$ pip install -r requirements.txt 
Requirement already satisfied: Django==1.8.18 in /Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages (from -r requirements.txt (line 1))
Requirement already satisfied: psycopg2==2.7.1 in /Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages (from -r requirements.txt (line 2))
Collecting libsass==0.13.2 (from -r requirements.txt (line 3))
  Using cached libsass-0.13.2.tar.gz
Could not import setuptools which is required to install from a source distribution.
Traceback (most recent call last):
  File "/Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages/pip/req/req_install.py", line 387, in setup_py
    import setuptools  # noqa
  File "/Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages/setuptools/__init__.py", line 10, in <module>
    from six.moves import filter, map
ImportError: No module named six.moves

Perhaps the entire dependency tree should be added to requirements.txt?
 

What version of pip runs in your pyenv? We're able to pip install requirements inside a new 2.7.10 virtualenv, that gets created with pip 9.0.1 by default.

Apologies - my virtual env was messed up.
 
 
- Scripts to yarn to compile the SCSS and run the application 
- Add startapp.sh script to start the application

The application runs under uWSGI - it's not going to be started via a script. It's auto-updated periodically from git, and uWSGI will restart when necessary so if any pre-processing of files is required, that needs to be done at startup automatically.

Okay, so it sounds like shelling out to yarn in wsgi would resolve this.

I think your suggestion below would be cleaner.

 
Otherwise, what does the auto-update process look like? perhaps compilation steps belong there rather than in app startup.

It's really just a GIT pull. uWSGI then detects the change and restarts that app. We could certainly have it do "git pull && yarn install && yarn run scss" or similar.

Now that said, the scss doesn't actually seem to build for me. I had to make 2 changes to get anywhere:

1) Change the tag in base.html to:

<link href="{% sass_src 'css/pgaweb.scss' %}" rel="stylesheet" type="text/css" />

2) Remove the STATIC_ROOT directive from settings.py (so it didn't try to compile to /static) and replace with COMPRESS_ROOT='static/' and SASS_PROCESSOR_ROOT='static/'.

That left me with a running site, that seems to behave as expected, at least when run standalone.

Patch attached - comments?

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Вложения

Re: [pgadmin-hackers][pgaweb][patch] Website patch to add SCSS

От
Sarah McAlear
Дата:
Hello Hackers,

We regenerated the add-readme.diff to include additions to .gitignore to ignore the compiled python files and the compiled CSS files and we added to yarn.lock file. 

Thanks,

Joao & Sarah


On Fri, Jul 14, 2017 at 10:24 AM, Joao De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:
Hello Dave,
Instead of using the current library we found another one that compiles the SCSS when the application starts.
We recreated the patches we sent before.

Thanks
Joao & Sarah

On Fri, Jul 14, 2017 at 5:42 AM, Dave Page <dpage@pgadmin.org> wrote:


On Wed, Jul 12, 2017 at 9:27 PM, George Gelashvili <ggelashvili@pivotal.io> wrote:
Hi Dave,
 
Hmm, seems like the dependencies are broken. Adding them throws me down what seems like a rabbit hole of manual installation, starting with:

(pgaweb) piranha:pgaweb dpage$ pip install -r requirements.txt 
Requirement already satisfied: Django==1.8.18 in /Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages (from -r requirements.txt (line 1))
Requirement already satisfied: psycopg2==2.7.1 in /Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages (from -r requirements.txt (line 2))
Collecting libsass==0.13.2 (from -r requirements.txt (line 3))
  Using cached libsass-0.13.2.tar.gz
Could not import setuptools which is required to install from a source distribution.
Traceback (most recent call last):
  File "/Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages/pip/req/req_install.py", line 387, in setup_py
    import setuptools  # noqa
  File "/Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages/setuptools/__init__.py", line 10, in <module>
    from six.moves import filter, map
ImportError: No module named six.moves

Perhaps the entire dependency tree should be added to requirements.txt?
 

What version of pip runs in your pyenv? We're able to pip install requirements inside a new 2.7.10 virtualenv, that gets created with pip 9.0.1 by default.

Apologies - my virtual env was messed up.
 
 
- Scripts to yarn to compile the SCSS and run the application 
- Add startapp.sh script to start the application

The application runs under uWSGI - it's not going to be started via a script. It's auto-updated periodically from git, and uWSGI will restart when necessary so if any pre-processing of files is required, that needs to be done at startup automatically.

Okay, so it sounds like shelling out to yarn in wsgi would resolve this.

I think your suggestion below would be cleaner.

 
Otherwise, what does the auto-update process look like? perhaps compilation steps belong there rather than in app startup.

It's really just a GIT pull. uWSGI then detects the change and restarts that app. We could certainly have it do "git pull && yarn install && yarn run scss" or similar.

Now that said, the scss doesn't actually seem to build for me. I had to make 2 changes to get anywhere:

1) Change the tag in base.html to:

<link href="{% sass_src 'css/pgaweb.scss' %}" rel="stylesheet" type="text/css" />

2) Remove the STATIC_ROOT directive from settings.py (so it didn't try to compile to /static) and replace with COMPRESS_ROOT='static/' and SASS_PROCESSOR_ROOT='static/'.

That left me with a running site, that seems to behave as expected, at least when run standalone.

Patch attached - comments?

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Вложения

Re: [pgadmin-hackers][pgaweb][patch] Website patch to add SCSS

От
Dave Page
Дата:
Thanks, applied with tweaks to the README and removal of yarn.lock - the server uses npm instead of yarn, because of various packaging issues/conflicts with hosting maintenance policy.

On Fri, Jul 14, 2017 at 3:38 PM, Sarah McAlear <smcalear@pivotal.io> wrote:
Hello Hackers,

We regenerated the add-readme.diff to include additions to .gitignore to ignore the compiled python files and the compiled CSS files and we added to yarn.lock file. 

Thanks,

Joao & Sarah


On Fri, Jul 14, 2017 at 10:24 AM, Joao De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:
Hello Dave,
Instead of using the current library we found another one that compiles the SCSS when the application starts.
We recreated the patches we sent before.

Thanks
Joao & Sarah

On Fri, Jul 14, 2017 at 5:42 AM, Dave Page <dpage@pgadmin.org> wrote:


On Wed, Jul 12, 2017 at 9:27 PM, George Gelashvili <ggelashvili@pivotal.io> wrote:
Hi Dave,
 
Hmm, seems like the dependencies are broken. Adding them throws me down what seems like a rabbit hole of manual installation, starting with:

(pgaweb) piranha:pgaweb dpage$ pip install -r requirements.txt 
Requirement already satisfied: Django==1.8.18 in /Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages (from -r requirements.txt (line 1))
Requirement already satisfied: psycopg2==2.7.1 in /Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages (from -r requirements.txt (line 2))
Collecting libsass==0.13.2 (from -r requirements.txt (line 3))
  Using cached libsass-0.13.2.tar.gz
Could not import setuptools which is required to install from a source distribution.
Traceback (most recent call last):
  File "/Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages/pip/req/req_install.py", line 387, in setup_py
    import setuptools  # noqa
  File "/Users/dpage/.virtualenvs/pgaweb/lib/python2.7/site-packages/setuptools/__init__.py", line 10, in <module>
    from six.moves import filter, map
ImportError: No module named six.moves

Perhaps the entire dependency tree should be added to requirements.txt?
 

What version of pip runs in your pyenv? We're able to pip install requirements inside a new 2.7.10 virtualenv, that gets created with pip 9.0.1 by default.

Apologies - my virtual env was messed up.
 
 
- Scripts to yarn to compile the SCSS and run the application 
- Add startapp.sh script to start the application

The application runs under uWSGI - it's not going to be started via a script. It's auto-updated periodically from git, and uWSGI will restart when necessary so if any pre-processing of files is required, that needs to be done at startup automatically.

Okay, so it sounds like shelling out to yarn in wsgi would resolve this.

I think your suggestion below would be cleaner.

 
Otherwise, what does the auto-update process look like? perhaps compilation steps belong there rather than in app startup.

It's really just a GIT pull. uWSGI then detects the change and restarts that app. We could certainly have it do "git pull && yarn install && yarn run scss" or similar.

Now that said, the scss doesn't actually seem to build for me. I had to make 2 changes to get anywhere:

1) Change the tag in base.html to:

<link href="{% sass_src 'css/pgaweb.scss' %}" rel="stylesheet" type="text/css" />

2) Remove the STATIC_ROOT directive from settings.py (so it didn't try to compile to /static) and replace with COMPRESS_ROOT='static/' and SASS_PROCESSOR_ROOT='static/'.

That left me with a running site, that seems to behave as expected, at least when run standalone.

Patch attached - comments?

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company





--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company