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 <dp...@pgadmin.org> wrote: > > > On Wed, Jul 12, 2017 at 9:27 PM, George Gelashvili <ggelashv...@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 >
diff --git a/README.md b/README.md new file mode 100644 index 0000000..f6ca619 --- /dev/null +++ b/README.md @@ -0,0 +1,67 @@ +PGAdmin Website + +# Installation instructions + +## Install Python dependencies +Run the command: + +```bash +pip install -r requirements.txt +``` + +## Create local settings file +Create a the file pgaweb/settings_local.py from pgaweb/settings.py changing the needed options to run locally. +For connection complaints inquiring about postgres "running locally and accepting connections on Unix domain socket...", +you'll need to change the `HOST` from the postgres data directory to `localhost`. + + +## Database setup + +### Create a new database + +Create a new database using the command + +```bash +createdb pgaweb +``` + +### Migrate database + +```bash +./manage.py migrate +``` + +### Populate the table + +You will at least need to: + +```bash +./manage.py loaddata ./versions/fixtures/versions.json +``` + +If you want to see the other content in the site running locally, +you will need to repeat this for the other fixtures: + +```bash +./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 +``` + +## Install frontend requirements + +```bash +pushd static +yarn install +popd +``` + +# Start the application + +```bash +./manage.py runserver +```
diff --git a/pgaweb/settings.py b/pgaweb/settings.py index 2ad99c9..7df43b8 100644 --- a/pgaweb/settings.py +++ b/pgaweb/settings.py @@ -49,7 +49,8 @@ INSTALLED_APPS = ( 'download', 'faq', 'news', - 'versions' + 'versions', + 'static_precompiler' ) MIDDLEWARE_CLASSES = ( @@ -121,7 +122,17 @@ USE_TZ = True # https://docs.djangoproject.com/en/1.8/howto/static-files/ STATIC_URL = '/static/' -STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),) +STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'), os.path.join(BASE_DIR, 'pgaweb', 'static')) + +STATIC_PRECOMPILER_ROOT = 'static' + +STATIC_PRECOMPILER_COMPILERS = ( + ('static_precompiler.compilers.libsass.SCSS', { + "sourcemap_enabled": True, + # "load_paths": ["/static/css"], + "precision": 8, + }), +) # Load local settings overrides from settings_local import * diff --git a/static/css/pgaweb.css b/pgaweb/static/css/pgaweb.scss similarity index 100% rename from static/css/pgaweb.css rename to pgaweb/static/css/pgaweb.scss diff --git a/pgaweb/templates/pgaweb/base.html b/pgaweb/templates/pgaweb/base.html index f5ea6a6..bece71f 100755 --- a/pgaweb/templates/pgaweb/base.html +++ b/pgaweb/templates/pgaweb/base.html @@ -1,4 +1,7 @@ {% load staticfiles %} +{% load compile_static %} +{% load static %} + <!DOCTYPE html> <html lang="en"> <head> @@ -15,7 +18,7 @@ <link href="{% static 'node_modules/bootstrap/dist/css/bootstrap.min.css' %}" rel="stylesheet"> <link href="{% static 'node_modules/font-mfizz/dist/font-mfizz.css' %}" rel="stylesheet" > <link href="{% static 'node_modules/font-awesome/css/font-awesome.min.css' %}" rel="stylesheet"> - <link href="{% static 'css/pgaweb.css' %}?2017060701" rel="stylesheet"> + <link rel="stylesheet" href="{% static "css/pgaweb.scss"|compile %}" /> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> diff --git a/requirements.txt b/requirements.txt index 6e83d47..be29f96 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ Django==1.8.18 psycopg2==2.7.1 +django-static-precompiler[libsass]==1.6