2022-02-18 15:34:33 +00:00
|
|
|
const middleware = require('storybook-django/src/middleware');
|
|
|
|
|
2023-02-14 11:17:58 +00:00
|
|
|
// Target the Django server with IPV4 address explicitly to avoid DNS resolution of localhost to IPV6.
|
|
|
|
const origin = process.env.TEST_ORIGIN ?? 'http://127.0.0.1:8000';
|
2022-02-18 15:34:33 +00:00
|
|
|
|
|
|
|
module.exports = middleware.createDjangoAPIMiddleware({
|
|
|
|
origin,
|
2022-02-18 16:07:09 +00:00
|
|
|
// Must match the patterns in urls.py.
|
|
|
|
apiPath: ['/pattern-library/', '/static/wagtailadmin/'],
|
2022-02-18 15:34:33 +00:00
|
|
|
});
|