profile
viewpoint
Ed Morley edmorley @heroku London, UK https://www.linkedin.com/in/edmorley Hi! I'm the Python language owner at Heroku.

edmorley/django-environ 1

Django-environ allows you to utilize 12factor inspired environment variables to configure your Django application.

edmorley/alpinehelloworld 0

An Alpine-based Docker example

edmorley/arewefastyet 0

AreWeFastYet is a set of tools used for benchmarking the major browser's JavaScript virtual machines against each other, as well as reporting the results on a website as insightful graphs showing the evolution of performance over time.

edmorley/autolander 0

Tools for integrating bugzilla and github workflows.

edmorley/babel-eslint 0

:tokyo_tower: A wrapper for Babel's parser used for ESLint

edmorley/bento 0

Packer templates for building minimal Vagrant baseboxes

edmorley/bmo 0

Read-only mirror of bugzilla.mozilla.org source from git.mozilla.org/webtools/bmo/bugzilla.git

edmorley/boot2docker 0

Lightweight Linux for Docker

edmorley/bootstrap 0

The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.

edmorley/boto 0

For the latest version of boto, see https://github.com/boto/boto3 -- Python interface to Amazon Web Services

issue closedevansd/whitenoise

Everything BUT Staticfile Requests are routing through Whitenoise Middleware

Hello, and apologies in advanced for being a Django noob,

I think that perhaps this might be a noob question, but I am using Whitenoise with the django-cookie-cutter project setup with Docker to serve only my static files. One caveat though: I am using ASGI, but as seen in issue #251 it seems as if Whitenoise effectively simulates synchronous loading perhaps ruling out ASGI as the source of my problems.

I'm trying to implement a system in which only authenticated users can access certain static files, as detailed here, but cut-down to show a demonstration. In addition, I am not worrying about performance as this is just for a very specific demo purpose that unfortunately I am having a lot more difficulty than I expected:

  • https://stackoverflow.com/questions/43271275/django-restrict-static-folder-access-to-non-logged-in-users
  • https://github.com/evansd/whitenoise/issues/124

Here's the middleware I'm using:

from whitenoise.middleware import WhiteNoiseMiddleware
import datetime
# this is a sample code, you can change for your use case
class ProtectedStaticFileMiddleware(WhiteNoiseMiddleware):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

    def __call__(self, request):
        response = super().__call__(request)
        print("Request: ", request)
        print("Response ", response)
       # This is where I would check if the response is from a authorized user
        response = self.process_response(request, response)
        return response

    def process_response(self, request, response):
        print("Response, Completed: ", response)
        # Resetting cache as you said in #124 
        response['Cache-Control'] = datetime.datetime.now()
        response['Expires'] = datetime.datetime.now()
        return response

I was expecting to see for every static file a printed print(response) and print(request) output, but here's what I receive: image

The only request the comes through the middleware is the GET request to "/", or 127.0.0.1:8000 (the main path), which means that I can't control who is authorized and who isn't. However - as you can see - my static files are being handled correctly! However, I can't get a hold of any of the static file request using even #124 which you said was a good idea to be able to authorize them.

Here are the relevant settings:

  • Running this only 127.0.0.1 using uvicorn, collect static has been run with CompressedManifestStaticFilesStorage.
whitenoise==5.2.0  # https://github.com/evansd/whitenoise
django==3.0.11  # https://www.djangoproject.com/
DEBUG = False
ROOT_DIR = Path(__file__).resolve(strict=True).parent.parent.parent
APPS_DIR = ROOT_DIR / "edsproject"
STATIC_ROOT = str(ROOT_DIR / "staticfiles")
STATIC_URL = "/static/"
STATICFILES_DIRS = [str(APPS_DIR / "static"), str(ROOT_DIR / "ui" /"dist")]
STATICFILES_FINDERS = [
    "django.contrib.staticfiles.finders.FileSystemFinder",
    "django.contrib.staticfiles.finders.AppDirectoriesFinder",
MIDDLEWARE = [
    "django.middleware.security.SecurityMiddleware",
    "whitenoise.middleware.WhiteNoiseMiddleware",
    "django.contrib.sessions.middleware.SessionMiddleware",
    "django.middleware.locale.LocaleMiddleware",
    "django.middleware.common.CommonMiddleware",
    "django.middleware.csrf.CsrfViewMiddleware",
    "django.contrib.auth.middleware.AuthenticationMiddleware",
    "django.contrib.messages.middleware.MessageMiddleware",
    "django.middleware.common.BrokenLinkEmailsMiddleware",
    "django.middleware.clickjacking.XFrameOptionsMiddleware",
    # Must go down here to pick up request object
    "users.middleware.ProtectedStaticFileMiddleware",
]
INSTALLED_APPS = ["whitenoise.runserver_nostatic"] + INSTALLED_APPS
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"```

closed time in 4 hours

omarsumadi

PR opened evansd/whitenoise

Add webp support for when a webp version of an image is available (with fallback for older browsers and CDN support).

Added a webp whitenoise middleware. It checks whether a webp version of an image is available and then serves that instead of the image itself. Also include the "Vary: Accept" header for CDNs.

+42 -0

0 comment

1 changed file

pr created time in 13 hours

startednwtgck/actions-comment-run

started time in a day

issue commentneutrinojs/webpack-chain

How to config pnp-webpack-plugin for yarn 2 pnp mode

This is what I use

config.resolve.plugin('pnp').use({ ...require(`pnp-webpack-plugin`) });
config.resolveLoader.plugin('pnp-loaders').use({ ...require('pnp-webpack-plugin').topLevelLoader });
lotosbin

comment created time in a day

created repositoryopensafely/opensafely-cli

Command line interface for OpenSAFELY

created time in 2 days

issue commentneutrinojs/webpack-chain

Create from existing webpack config object

This could also be a great way to allow for cloning webpack-chain config, since according to another issue is not yet possible.

joeldenning

comment created time in 2 days

created tagheroku/heroku-buildpack-php

tagv185

The official PHP buildpack for Heroku.

created time in 2 days

push eventheroku/heroku-buildpack-php

David Zuelke

commit sha 9a5f6afc9e562d268a1232679ebea45e4f36b3c9

reminder comment to eventually depend on heroku-sys/php in heroku-sys/composer

view details

David Zuelke

commit sha e3b6272109de1c04f0067b6bb9856cd68c5acc6e

fix composer bin-dir export this has always been broken, just nobody noticed... it exported /app/vendor/bin etc initially, and since v184, it was broken in a different way

view details

David Zuelke

commit sha ee3237c76258e70dbefd1e939521523b5229553d

test for broken export PATH export

view details

David Zuelke

commit sha f9d32b3fcd1df8d8ad7c14839cdca815f5802857

fix relative bin-dir on $PATH at runtime

view details

David Zuelke

commit sha d346838c1b47a9198e570cd3871e15871282e199

Revert "drop absolute $PATH tests"

view details

David Zuelke

commit sha 5af8f0ca11a4ae505b428e086407842a62fcae8e

update test runtimes log bugs_spec.rb now for all stacks

view details

David Zülke

commit sha f9f96a05c4b5bd552594bb789413d8665ba77c64

Merge pull request #448 from heroku/develop Fix composer bin-dir $PATH settings

view details

push time in 2 days

PR merged heroku/heroku-buildpack-php

Fix composer bin-dir $PATH settings
  • at runtime, it's a relative path (minor)
  • at build time, it's never been exported correctly (because it added /app/vendor/bin, not /tmp/build…/vendor/bin), but now the export also causes an error message (without affecting build success)
+154 -3

0 comment

11 changed files

dzuelke

pr closed time in 2 days

push eventheroku/heroku-buildpack-php

David Zuelke

commit sha ee3237c76258e70dbefd1e939521523b5229553d

test for broken export PATH export

view details

David Zuelke

commit sha f9d32b3fcd1df8d8ad7c14839cdca815f5802857

fix relative bin-dir on $PATH at runtime

view details

David Zuelke

commit sha d346838c1b47a9198e570cd3871e15871282e199

Revert "drop absolute $PATH tests"

view details

David Zuelke

commit sha 5af8f0ca11a4ae505b428e086407842a62fcae8e

update test runtimes log bugs_spec.rb now for all stacks

view details

push time in 2 days

delete branch neutrinojs/neutrino

delete branch : renovate/eslint-plugin-standard-5.x

delete time in 2 days

push eventheroku/heroku-buildpack-php

David Zuelke

commit sha 0a55ebee61ac34b1b732e85107446e68656ae5a8

test for broken export PATH export

view details

David Zuelke

commit sha eb593c1df57f49213aba8705f82968a2c2a599a2

fix relative bin-dir on $PATH at runtime

view details

David Zuelke

commit sha 2b6c264a654fe358e309ef2d309c9f3b997f06c5

Revert "drop absolute $PATH tests"

view details

David Zuelke

commit sha f16eaf6d944036cdf0bd37f9176f362e85d8e0b7

update test runtimes log bugs_spec.rb now for all stacks

view details

push time in 2 days

push eventheroku/heroku-buildpack-php

David Zuelke

commit sha e3b6272109de1c04f0067b6bb9856cd68c5acc6e

fix composer bin-dir export this has always been broken, just nobody noticed... it exported /app/vendor/bin etc initially, and since v184, it was broken in a different way

view details

David Zuelke

commit sha 32438d4ff400fa164f9740ac423e4e47b235bee5

test for broken export PATH export

view details

David Zuelke

commit sha e17682f50fce0fb700770d278c2ab2420499210d

fix relative bin-dir on $PATH at runtime

view details

David Zuelke

commit sha 81cec7addc53451ebd9a583598dd7512a9fdd7d8

Revert "drop absolute $PATH tests"

view details

push time in 2 days

create barnchneutrinojs/neutrino

branch : renovate/eslint-plugin-standard-5.x

created branch time in 2 days

PR opened heroku/heroku-buildpack-php

Fix composer bin-dir $PATH settings
  • at runtime, it's a relative path (minor)
  • at build time, it's never been exported correctly (because it added /app/vendor/bin, not /tmp/build…/vendor/bin), but now the export also causes an error message (without affecting build success)
+149 -2

0 comment

7 changed files

pr created time in 2 days

push eventheroku/heroku-buildpack-php

David Zülke

commit sha d978bc3dc4d7d7bfb5e30746b14d9e589d6b5f43

Merge pull request #447 from heroku/develop Composer 2 support

view details

David Zuelke

commit sha 9a5f6afc9e562d268a1232679ebea45e4f36b3c9

reminder comment to eventually depend on heroku-sys/php in heroku-sys/composer

view details

David Zuelke

commit sha 1983445eae10c81613517e59f3d3f07975f4d18d

fix composer bin-dir export this has always been broken, just nobody noticed... it exported /app/vendor/bin etc initially, and since v184, it was broken in a different way

view details

David Zuelke

commit sha b2a528844d8e94fdfb6108037581e723663f0ddd

test for broken export PATH export

view details

David Zuelke

commit sha 5c56f0b4ae12131696356b679918e013671f817f

fix relative bin-dir on $PATH at runtime

view details

David Zuelke

commit sha a57baae884937556478d5a65fc0e59b6f8b69648

Revert "drop absolute $PATH tests"

view details

push time in 2 days

startedhakavlad/nohang

started time in 2 days

push eventneutrinojs/neutrino

Renovate Bot

commit sha 6bdb31947c05281056ed191feaf6358e8ac3e574

Update dependency mkdocs-material to v6.1.6

view details

push time in 3 days

issue commentheroku/heroku-buildpack-python

Error downloading NLTK corpora

Sorry for commenting on the closed issue. I'm still facing the issue with nltk installation onto heroku.

@daegloe , @YaxianLin what is exact fix for this problem?

did you find the solution?

daegloe

comment created time in 3 days

issue openedneutrinojs/neutrino

Jest: custom moduleNameMapper entries should have priority

When custom moduleNameMapper config is provided, it ends up at the bottom of the list, below automatic configuration for static file types (stylesheets / images). This causes problems when mocking out more complex interpretations of these file types (e.g. SVGR creates additional exports for SVG files).

For example:

    jest({
      moduleNameMapper: {
        '\\.svg$': '<rootDir>/mocks/svgr.js',
      },
    }),

Where svgr.js contains:

export const ReactComponent = () => null;
export default '';

The given config is ignored, because the built-in SVG rule takes priority (using file-mock).


This could be fixed by putting user-specified moduleNameMapper entries at the top of the resulting config, rather than the bottom. I think it is reasonable for anything the user specifies to override the defaults.

created time in 3 days

issue commentneutrinojs/neutrino

svgr for react preset?

For anybody arriving here who just wants to know how to enable SVGR with neutrino, I believe this is the best way:

module.exports = {
  use: [
    /* ... */
    (neutrino) => neutrino.config.module
      .rule('svgr')
      .test(/\.svg$/)
      .issuer({ test: /\.[tj]sx?$/ }) // optional, but lets you continue importing SVGs from CSS files etc. without it breaking
      .use('@svgr/webpack')
      .loader(require.resolve('@svgr/webpack')),
    // note that the svgr configuration MUST BE BEFORE the react preset
    react({ /* ... */ }),
    /* ... */
  ],
};

(don't forget to run npm install --save-dev @svgr/webpack too)

Usage:

import { ReactComponent as Star } from './star.svg';

const App = () => (<Star />);

If you want it to work with typescript, you need to provide a boilerplate definition for svg files, for example (definition sourced from here):

// This file lives in types/svgr.d.ts (the filename is arbitrary)

declare module '*.svg' {
  const ReactComponent: React.FC<React.SVGProps<SVGSVGElement>>;
  const content: string;

  export { ReactComponent };
  export default content;
}

And make sure your tsconfig is configured to use that folder for types, e.g:

typescript({ tsconfig: {
  compilerOptions: {
    typeRoots: ['src/types', 'node_modules/@types'],
  },
} })
timkelty

comment created time in 3 days

issue commentheroku/heroku-buildpack-python

GEOS and GDAL issues

https://help.heroku.com/D5INLB1A/python-s-build_with_geo_libraries-legacy-feature-is-no-longer-supported

alexei

comment created time in 4 days

issue commentheroku/heroku-buildpack-php

Support for Composer 2

Ready when y'all are: https://devcenter.heroku.com/changelog-items/1954

Enjoy, please speak up if anything is wonky, and thanks for all the patience!

Happy weekend and happy pushing ✌️

phanan

comment created time in 4 days

created tagheroku/heroku-buildpack-php

tagv184

The official PHP buildpack for Heroku.

created time in 4 days

issue commentheroku/heroku-buildpack-php

Support for Composer 2

(give the tag test runs ~ten minutes to complete before rollout to the platform can commence) /cc @railto

phanan

comment created time in 4 days

issue commentheroku/heroku-buildpack-php

Support for Composer 2

Thanks @dzuelke, looking forward to testing this.

phanan

comment created time in 4 days

issue commentheroku/heroku-buildpack-php

Support for Composer 2

Test away @phanan, @stof, @hex333ham, @YvanoDelavega, @thomas-seres, and everybody else.

/cc @naderman @seldaek

phanan

comment created time in 4 days

push eventheroku/heroku-buildpack-php

David Zuelke

commit sha 6740cdb8007a5e5db6cc9aaa83f3e2ec8ba6099c

support platform package type 'heroku-sys-program'

view details

David Zuelke

commit sha 03bf798d987d6f1921c5577337f24c47226b6385

make 'composer' a 'heroku-sys-program' it now bundles its own export/profile scripts that can be used if installed by the platform installer

view details

David Zuelke

commit sha 668ae22129e0bfd68ff654c46e370312a3b90670

install Composer using platform installer

view details

David Zuelke

commit sha d9d0f6c5cd0d6c8cf9e7df377fd7f1f20fe49034

Support Composer 2 and add 2.0.7 Closes #440

view details

David Zuelke

commit sha a5ab54145496f4b1d10bcff45cffae5736293194

test runtimes for composer_spec.rb

view details

David Zuelke

commit sha 92584aa1a68fa0003f911e006fdcd895d1c428c8

composer install --no-progress Messes too much with the output in Composer 2: remote: Installing dependencies from lock file remote: Verifying lock file contents can be installed on current platform. remote: Package operations: 2 installs, 0 updates, 0 removals remote: 0 [>---------------------------] 0 [>---------------------------] - Installing psr/log (1.1.3): Extracting archive remote: - Installing monolog/monolog (2.1.1): Extracting archive remote: 0/2 [>---------------------------] 0% remote: 1/2 [==============>-------------] 50% remote: 2/2 [============================] 100%Generating optimized autoload files

view details

David Zuelke

commit sha 00d43ad7506bdba1cac5cc441431b5439ed860d4

Fix ext-newrelic always printing info log messages

view details

David Zuelke

commit sha 210e585ceab7be90f65cd5ddf686a50dddbbc42c

fix HEROKU_PHP_DEFAULT_RUNTIME_VERSION default usage in platform.php only matters in local dev testing

view details

David Zuelke

commit sha 1b3fbe4b6845e34f7f2ecf4598a267c98292cfd2

drop absolute $PATH tests the buildpack that tests this runs with pwd in a subdir or something, so it breaks with a $(composer config) expression

view details

David Zuelke

commit sha cb7283332814799487f5e5887b150d2df2bd14a1

ensure we run Composer 1 for test setups etc otherwise we'll generate e.g. v2 locks for HHVM etc

view details

David Zuelke

commit sha 08b9877e4b3634b59c9d159e3eaaac200b9f037e

bc composer wrapper for HHVM

view details

David Zülke

commit sha d978bc3dc4d7d7bfb5e30746b14d9e589d6b5f43

Merge pull request #447 from heroku/develop Composer 2 support

view details

push time in 4 days

PR merged heroku/heroku-buildpack-php

Composer 2 support languages-review
  • platform install still happens with Composer 1 for now
  • Composer is now a heroku-sys-program (new type) and installed via the platform install step
  • it uses plugin API provides to auto pick the right version based on lock file
  • only either v1 or v2 are installed, not both (composer1 is used only for platform installs and then removed)
  • no more download progress output since it messed up output massively (see commit)
  • also fixed a New Relic info log output regression

Closes #440

+211 -52

0 comment

27 changed files

dzuelke

pr closed time in 4 days

issue closedheroku/heroku-buildpack-php

Support for Composer 2

Now that Composer 2 has been released, can we have it supported by the buildpack? Currently, composer.lock files generated by Composer 2 simply do not work with Heroku due to the Composer version being hardcoded.

closed time in 4 days

phanan
more