Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1539a8c

Browse filesBrowse files
authored
Merge branch 'master' into rukku-patch-1
2 parents 7499b64 + 7c983b5 commit 1539a8c
Copy full SHA for 1539a8c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

48 files changed

+742
-287
lines changed
Open diff view settings
Collapse file

‎Dockerfile‎

Copy file name to clipboard
+12-7Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
FROM python:2.7.7
1+
FROM python:3.8.1
22

3-
RUN curl -sL https://deb.nodesource.com/setup | bash -
3+
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
44
RUN apt-get -y install nodejs
55
RUN apt-get -y install libcairo-dev
66

7-
RUN pip install virtualenv
8-
97
RUN mkdir -p /usr/src/app
10-
WORKDIR /usr/src/app
11-
COPY . /usr/src/app
128

13-
ENTRYPOINT ["./docker-entrypoint"]
9+
COPY package.json /usr/src/app/
10+
RUN npm install --prefix /usr/src/app/
11+
12+
COPY requirements.txt /usr/src/app
13+
RUN pip install -r /usr/src/app/requirements.txt
14+
15+
COPY . /usr/src/app
16+
WORKDIR /usr/src/app
17+
RUN npm run-script build-jobs
1418

19+
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
Collapse file

‎LICENSE‎

Copy file name to clipboard
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 pythonph
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Collapse file

‎README.md‎

Copy file name to clipboardExpand all lines: README.md
+12Lines changed: 12 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
POSTGRES_PASSWORD=password
3434
SLACK_ORG=pythonph
3535
SLACK_API_TOKEN=xxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxxx-xxxxxxxxxx
36+
SLACK_BOARD_CHANNEL=pythonph
37+
SLACK_JOBS_CHANNEL=jobs
3638
```
3739

3840
5. Setup Django
@@ -48,3 +50,13 @@
4850
npm start
4951
```
5052

53+
## Development Setup via docker-compose
54+
1. `./bin/build-dev`
55+
2. `./bin/deploy-dev`
56+
57+
Note: For this setup, you have to run `./bin/build-dev && ./bin/deploy-dev` for changes to reflect.
58+
59+
60+
## Todo
61+
1. Improve dockerized development setup
62+
Collapse file

‎bin/build-dev‎

Copy file name to clipboard
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
set -e
3+
4+
docker build --rm -t pythonph/pythonph .
5+
COMPOSE="docker-compose -f docker-compose-dev.yml"
6+
$COMPOSE build nginx
7+
$COMPOSE up -d source
8+
$COMPOSE logs source
Collapse file

‎bin/deploy-dev‎

Copy file name to clipboard
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
set -e
3+
4+
COMPOSE="docker-compose -f docker-compose-dev.yml"
5+
$COMPOSE up -d --force-recreate web nginx db
Collapse file

‎common/templates/base.html‎

Copy file name to clipboardExpand all lines: common/templates/base.html
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{% load staticfiles %}
22
{% load compress %}
3+
34
<!DOCTYPE html>
45
<html lang="en">
56
<head>
@@ -16,6 +17,7 @@
1617
{% endcompress %}
1718
{% endblock %}
1819
<link rel="icon" type="image/png" href="images/favicon.png">
20+
1921
<script>
2022
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
2123
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -25,6 +27,7 @@
2527
ga('send', 'pageview');
2628
</script>
2729
</head>
30+
2831
<body>
2932
<div class="container">{% block content %}{% endblock %}</div>
3033
{% block js %}
Collapse file

‎docker-compose-dev.yml‎

Copy file name to clipboard
+38Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
source:
2+
image: pythonph/pythonph
3+
volumes:
4+
- /usr/src/app/venv
5+
- /usr/src/app/node_modules
6+
- /usr/src/app/bower_components
7+
- /usr/src/app/static
8+
environment:
9+
- ENV=DEV
10+
env_file: dev.env
11+
command: bin/install
12+
13+
db:
14+
image: postgres:latest
15+
environment:
16+
- ENV=DEV
17+
env_file: dev.env
18+
19+
web:
20+
image: pythonph/pythonph
21+
volumes_from:
22+
- source
23+
environment:
24+
- ENV=DEV
25+
env_file: dev.env
26+
ports:
27+
- 8000:8000
28+
links:
29+
- db:db
30+
command: gunicorn -b 0.0.0.0:8000 --access-logfile - --error-logfile - pythonph.wsgi
31+
32+
nginx:
33+
build: nginx
34+
ports:
35+
- 8080:80
36+
- 443:443
37+
links:
38+
- web:web
Collapse file

‎docker-entrypoint‎

Copy file name to clipboardExpand all lines: docker-entrypoint
-8Lines changed: 0 additions & 8 deletions
This file was deleted.
Collapse file

‎jobs/__init__.py‎

Copy file name to clipboard
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
from jobs import api, urls
Collapse file

‎jobs/admin.py‎

Copy file name to clipboard
+19-4Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
1+
from django.conf import settings
12
from django.contrib import admin
2-
from django_markdown.admin import MarkdownModelAdmin
3-
from jobs.models import Company, Job
3+
from markdownx.admin import MarkdownxModelAdmin
44

5-
admin.site.register(Company, MarkdownModelAdmin)
6-
admin.site.register(Job, MarkdownModelAdmin)
5+
from common.utils import notify_slack
6+
from .models import Company, Job
77

8+
9+
class JobAdmin(MarkdownxModelAdmin):
10+
def save_model(self, request, obj, form, change):
11+
data = form.cleaned_data
12+
super().save_model(request, obj, form, change)
13+
14+
if 'is_approved' in form.changed_data and data.get('is_approved'):
15+
notify_slack(
16+
'✨ *New job posting* ✨ \n {} \n {} \n\n :python: <https://python.ph/jobs|python.ph/jobs>'.format(obj.title, obj.company.name),
17+
settings.SLACK_JOBS_CHANNEL
18+
)
19+
20+
21+
admin.site.register(Company, MarkdownxModelAdmin)
22+
admin.site.register(Job, JobAdmin)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.