Skip to content

Commit 1e838e2

Browse files
authored
Merge pull request #357 from maykinmedia/upgrade
Upgrade to Django 3.2
2 parents 7c1e2b3 + b1dab37 commit 1e838e2

File tree

106 files changed

+7915
-10070
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+7915
-10070
lines changed

.github/workflows/ci.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ env:
1515
jobs:
1616
tests:
1717
name: Run the Django test suite
18-
runs-on: ubuntu-20.04
18+
runs-on: ubuntu-latest
1919

2020
services:
2121
postgres:
@@ -28,13 +28,13 @@ jobs:
2828
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
2929

3030
steps:
31-
- uses: actions/checkout@v2
32-
- uses: actions/setup-python@v2
31+
- uses: actions/checkout@v4
32+
- uses: actions/setup-python@v5
3333
with:
34-
python-version: '3.7'
35-
- uses: actions/setup-node@v2-beta
34+
python-version: '3.10'
35+
- uses: actions/setup-node@v4
3636
with:
37-
node-version: '12'
37+
node-version: '18'
3838

3939
- name: Install system packages
4040
run: |
@@ -61,16 +61,16 @@ jobs:
6161
DB_PASSWORD: ''
6262

6363
- name: Publish coverage report
64-
uses: codecov/codecov-action@v1
64+
uses: codecov/codecov-action@v3
6565

6666
docker:
6767
needs: tests
6868

6969
name: Build (and push) Docker image
70-
runs-on: ubuntu-20.04
70+
runs-on: ubuntu-latest
7171

7272
steps:
73-
- uses: actions/checkout@v2
73+
- uses: actions/checkout@v4
7474

7575
- name: Set tag
7676
id: vars

.github/workflows/code-quality.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ jobs:
88
runs-on: ubuntu-latest
99

1010
steps:
11-
- uses: actions/checkout@v2
12-
- uses: actions/setup-python@v2
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-python@v5
1313
with:
14-
python-version: '3.7'
15-
- uses: isort/isort-action@v0.1.0
14+
python-version: '3.10'
15+
- uses: isort/isort-action@v1
1616
with:
1717
requirementsFiles: requirements/dev.txt
1818
sortPaths: "src docs"
@@ -23,10 +23,10 @@ jobs:
2323
runs-on: ubuntu-latest
2424

2525
steps:
26-
- uses: actions/checkout@v2
27-
- uses: actions/setup-python@v2
26+
- uses: actions/checkout@v4
27+
- uses: actions/setup-python@v5
2828
with:
29-
python-version: '3.7'
29+
python-version: '3.10'
3030
- name: Install dependencies
3131
run: |
3232
pip install -r requirements/dev.txt

.github/workflows/codeql-analysis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838

3939
steps:
4040
- name: Checkout repository
41-
uses: actions/checkout@v3
41+
uses: actions/checkout@v4
4242

4343
# Initializes the CodeQL tools for scanning.
4444
- name: Initialize CodeQL
@@ -48,11 +48,11 @@ jobs:
4848
# If you wish to specify custom queries, you can do so here or in a config file.
4949
# By default, queries listed here will override any specified in a config file.
5050
# Prefix the list here with "+" to use these queries and those in the config file.
51-
51+
5252
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
5353
# queries: security-extended,security-and-quality
5454

55-
55+
5656
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5757
# If this step fails, then you should remove it and run the build manually (see below)
5858
- name: Autobuild

.github/workflows/generate-postman-collection.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ jobs:
1616
matrix:
1717
version: ['v1', 'v2']
1818

19-
name: Run with version v${{ matrix.version }}
19+
name: Run with version ${{ matrix.version }}
2020

2121
steps:
22-
- uses: actions/checkout@v2
22+
- uses: actions/checkout@v4
2323
- name: Use Node.js
24-
uses: actions/setup-node@v1
24+
uses: actions/setup-node@v4
2525
with:
26-
node-version: '12'
26+
node-version: '18'
2727
- name: Install dependencies
2828
run: npm install -g openapi-to-postmanv2
2929
- name: Create tests folder

.github/workflows/generate-sdks.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ jobs:
1616
matrix:
1717
version: [ 'v1', 'v2' ]
1818

19-
name: Run with version v${{ matrix.version }}
19+
name: Run with version ${{ matrix.version }}
2020

2121
steps:
22-
- uses: actions/checkout@v2
22+
- uses: actions/checkout@v4
2323
- name: Use Node.js
24-
uses: actions/setup-node@v1
24+
uses: actions/setup-node@v4
2525
with:
26-
node-version: '12'
26+
node-version: '18'
2727
- name: Install dependencies
2828
run: npm install -g @openapitools/openapi-generator-cli
2929
- name: Determing oas path

.github/workflows/lint-oas.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ jobs:
1616
matrix:
1717
version: [ 'v1', 'v2' ]
1818

19-
name: Run with version v${{ matrix.version }}
19+
name: Run with version ${{ matrix.version }}
2020

2121
steps:
22-
- uses: actions/checkout@v2
22+
- uses: actions/checkout@v4
2323
- name: Use Node.js
24-
uses: actions/setup-node@v1
24+
uses: actions/setup-node@v4
2525
with:
26-
node-version: '12'
26+
node-version: '18'
2727
- name: Install spectral
2828
run: npm install -g @stoplight/spectral@5
2929
- name: Run OAS linter

.github/workflows/quick-start.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ on: [push]
44

55
jobs:
66
run:
7-
runs-on: ubuntu-20.04
7+
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v2
9+
- uses: actions/checkout@v4
1010
- name: Download docker-compose file
1111
run: wget https://raw.githubusercontent.com/maykinmedia/objects-api/master/docker-compose-quickstart.yml -O docker-compose-qs.yml
1212
- name: Overwrite the docker-compose file to get the "current" one

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18

.pep8

-4
This file was deleted.

Dockerfile

+20-13
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,62 @@
11
# Stage 1 - Compile needed python dependencies
2-
FROM python:3.7-buster AS build
2+
FROM python:3.10-slim-bullseye AS backend-build
33

44
RUN apt-get update && apt-get install -y --no-install-recommends \
5+
pkg-config \
6+
build-essential \
7+
git \
58
libpq-dev \
69
&& rm -rf /var/lib/apt/lists/*
710

11+
812
WORKDIR /app
913

1014
COPY ./requirements /app/requirements
11-
RUN pip install pip 'setuptools<59.0' -U
15+
RUN pip install pip --upgrade
1216
RUN pip install -r requirements/production.txt
1317

1418

1519
# Stage 2 - build frontend
16-
FROM mhart/alpine-node:12 AS frontend-build
20+
FROM node:18-alpine AS frontend-build
1721

1822
WORKDIR /app
1923

2024
COPY ./*.json /app/
2125
RUN npm ci
2226

23-
COPY ./gulpfile.js ./webpack.config.js ./.babelrc /app/
27+
COPY ./webpack.config.js ./.babelrc /app/
2428
COPY ./build /app/build/
2529

26-
COPY src/objects/sass/ /app/src/objects/sass/
30+
COPY src/objects/scss/ /app/src/objects/scss/
2731
COPY src/objects/js/ /app/src/objects/js/
2832
RUN npm run build
2933

3034

3135
# Stage 3 - Build docker image suitable for execution and deployment
32-
FROM python:3.7-buster AS production
36+
FROM python:3.10-slim-bullseye AS production
3337

3438
# Stage 3.1 - Set up the needed production dependencies
3539
# install all the dependencies for GeoDjango
3640
RUN apt-get update && apt-get install -y --no-install-recommends \
3741
postgresql-client \
38-
libgdal20 \
39-
libgeos-c1v5 \
40-
libproj13 \
42+
binutils \
43+
libproj-dev \
44+
gdal-bin \
45+
libgdal-dev \
4146
&& rm -rf /var/lib/apt/lists/*
4247

43-
COPY --from=build /usr/local/lib/python3.7 /usr/local/lib/python3.7
44-
COPY --from=build /usr/local/bin/uwsgi /usr/local/bin/uwsgi
48+
COPY --from=backend-build /usr/local/lib/python3.10 /usr/local/lib/python3.10
49+
COPY --from=backend-build /usr/local/bin/uwsgi /usr/local/bin/uwsgi
4550

4651
# Stage 3.2 - Copy source code
4752
WORKDIR /app
4853
COPY ./bin/docker_start.sh /start.sh
4954
RUN mkdir /app/log /app/config
5055

51-
COPY --from=frontend-build /app/src/objects/static/css /app/src/objects/static/css
52-
COPY --from=frontend-build /app/src/objects/static/js /app/src/objects/static/js
56+
# copy frontend build statics
57+
COPY --from=frontend-build /app/src/objects/static /app/src/objects/static
58+
59+
# copy source code
5360
COPY ./src /app/src
5461

5562
RUN useradd -M -u 1000 user

INSTALL.rst

+5-10
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Prerequisites
1818

1919
You need the following libraries and/or programs:
2020

21-
* `Python`_ 3.7 or above
21+
* `Python`_ 3.10 or above
2222
* Python `Virtualenv`_ and `Pip`_
2323
* `PostgreSQL`_ 12 or above with PostGIS extension
2424
* `Node.js`_
@@ -47,22 +47,20 @@ development machine.
4747
$ git clone git@github.com:maykinmedia/objects-api.git
4848
$ cd objects-api
4949
50-
3. Install all required libraries.
50+
3. Install all required (backend) libraries.
5151

5252
.. code-block:: bash
5353
5454
$ virtualenv env
5555
$ source env/bin/activate
5656
$ pip install -r requirements/dev.txt
5757
58-
4. Install the front-end CLI tool `gulp`_ if you've never installed them
59-
before and install the frontend libraries:
58+
4. Install all required (frontend) libraries and build static files.
6059

6160
.. code-block:: bash
6261
63-
$ npm install -g gulp
6462
$ npm install
65-
$ gulp sass
63+
$ npm run build
6664
6765
5. Activate your virtual environment and create the statics and database:
6866

@@ -94,12 +92,9 @@ development machine.
9492
``src/objects/conf/local.py``. You can base this file on the
9593
example file included in the same directory.
9694

97-
**Note:** You can run watch-tasks to compile `Sass`_ to CSS and `ECMA`_ to JS
98-
using `gulp`_. By default this will compile the files if they change.
9995

10096
.. _ECMA: https://ecma-international.org/
10197
.. _Sass: https://sass-lang.com/
102-
.. _gulp: https://gulpjs.com/
10398

10499

105100
Update installation
@@ -121,7 +116,7 @@ When updating an existing installation:
121116
$ git pull
122117
$ pip install -r requirements/dev.txt
123118
$ npm install
124-
$ gulp sass
119+
$ npm run build
125120
126121
3. Update the statics and database:
127122

build/paths.js

+11-27
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
var path = require('path');
2-
var fs = require('fs');
1+
const fs = require('fs');
32

43

54
/** Parses package.json */
6-
var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
5+
const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
76

8-
/** Name of the sources directory */
9-
var sourcesRoot = 'src/' + pkg.name + '/';
7+
/** Src dir */
8+
const sourcesRoot = 'src/' + pkg.name + '/';
109

11-
/** Name of the static (source) directory */
12-
var staticRoot = sourcesRoot + 'static/';
10+
/** "Main" static dir */
11+
const staticRoot = sourcesRoot + 'static/';
1312

1413

1514
/**
@@ -19,32 +18,23 @@ module.exports = {
1918
// Parsed package.json
2019
package: pkg,
2120

22-
// Path to the sass (sources) directory
23-
sassSrcDir: sourcesRoot + 'sass/',
21+
// Path to the scss entry point
22+
scssEntry: sourcesRoot + 'scss/screen.scss',
2423

25-
// Path to the sass (sources) entry point
26-
sassSrc: sourcesRoot + 'sass/**/*.scss',
27-
28-
// Path to the (transpiled) css directory
29-
cssDir: staticRoot + 'css/',
30-
31-
// Path to the fonts directory
32-
fontsDir: staticRoot + 'fonts/',
24+
// Path to the scss (sources) directory
25+
scssSrcDir: sourcesRoot + 'scss/',
3326

3427
// Path to the js entry point (source)
3528
jsEntry: sourcesRoot + 'js/index.js',
3629

37-
// Path to the js (sources) directory
38-
jsSrcDir: sourcesRoot + 'js/',
39-
4030
// Path to js (sources)
4131
jsSrc: sourcesRoot + 'js/**/*.js',
4232

4333
// Path to the js (sources) directory
4434
jsSrcDir: sourcesRoot + 'js/',
4535

4636
// Path to the (transpiled) js directory
47-
jsDir: staticRoot + 'js/',
37+
jsDir: staticRoot + 'bundles/',
4838

4939
// Path to js spec (test) files
5040
jsSpec: sourcesRoot + 'jstests/**/*.spec.js',
@@ -54,10 +44,4 @@ module.exports = {
5444

5545
// Path to js code coverage directory
5646
coverageDir: 'reports/jstests/',
57-
58-
// Path to HTML templates directory
59-
htmlTemplatesDir: sourcesRoot + 'templates/views',
60-
61-
// Path to HTML includes directory
62-
htmlIncludesDir: sourcesRoot + 'templates/components/'
6347
};

build/tasks/build.js

-8
This file was deleted.

0 commit comments

Comments
 (0)