Skip to content

Commit d4d22c1

Browse files
committed
making env better
1 parent 06d030f commit d4d22c1

Some content is hidden

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

53 files changed

+1037
-6639
lines changed

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,5 @@ django_dev.log
1313
logs/
1414
celerybeat-schedule
1515
celerybeat.pid
16-
client_secret.json
17-
dist/
18-
opensource_job_portal.egg-info/
19-
docs/build
16+
.env
17+
resume/

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ deploy_live:
66
environment:
77
name: live
88
script:
9-
- rm -rf /home/peeljobs/peeljobs; cp -r . /home/peeljobs/peeljobs
9+
- sudo /bin/rm -rf /home/peeljobs/peeljobs/; cp -r . /home/peeljobs/peeljobs
1010
- source /home/peeljobs/env/bin/activate
1111
- pip install -r /home/peeljobs/peeljobs/requirements.txt
1212
- python /home/peeljobs/peeljobs/manage_server.py migrate --noinput

LICENSE

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1 @@
1-
MIT License
2-
3-
Copyright (c) 2017 MicroPyramid
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.
1+
.

MANIFEST.in

Lines changed: 0 additions & 2 deletions
This file was deleted.

README.md

Lines changed: 58 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,69 @@
1-
opensource job portal
2-
=====================
1+
Peel Jobs
2+
===========
3+
Opensource Job Portal developed in python django with Unlimited free job posting, Social Api's authentication.
34

4-
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/105a3bf03bec4cfbac70d7c30e574bea)](https://www.codacy.com/manual/ashwin/opensource-job-portal?utm_source=github.com&utm_medium=referral&utm_content=MicroPyramid/opensource-job-portal&utm_campaign=Badge_Grade)
5+
# Recruiter
6+
* Can post jobs to social networking sites like facebook, twitter, linkedin.
7+
* Walk-in's
8+
* Copy An Existing Job Post, Deactivate.
9+
* Add localtion in Google Maps
10+
* Post their job to social networking sites.
511

6-
[![Build Status](https://travis-ci.org/MicroPyramid/opensource-job-portal.svg?branch=master)](https://travis-ci.org/MicroPyramid/opensource-job-portal)
12+
# Portal
13+
* Job Alerts
14+
* New Mobile Design
15+
* Normal Search and Advanced Search
16+
* Email Notifications
717

8-
[![Coverage Status](https://coveralls.io/repos/github/MicroPyramid/opensource-job-portal/badge.svg?branch=master)](https://coveralls.io/github/MicroPyramid/opensource-job-portal?branch=master)
918

10-
https://opensource-job-portal.readthedocs.io/en/latest/ for latest documentation
11-
Job Portal with Unlimited free job posting, Social Api's authentication.
19+
# Setup
20+
These are setup instruction for ubuntu 18.04
1221

13-
Recruiter
14-
----------
22+
```
23+
sudo apt install git postgresql python3 python3-dev python3-venv libpq-dev build-essential ruby ruby-dev gem redis-server memcached redis-tools -y
24+
curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh
25+
sudo bash nodesource_setup.sh
26+
sudo apt-get install node-less
27+
```
1528

16-
Enhancements:
29+
Install and configure sass and less compilers
30+
```
31+
sudo gem install sass
32+
```
1733

18-
* Can post jobs to social networking sites like facebook, twitter, linkedin.
19-
* Walk-in's
20-
* Copy An Existing Job Post, Deactivate.
21-
* Added Google Maps
22-
* Mobile Number Authentication
23-
* Post their job post message into social networking sites.
34+
you need to create symbolic link if you get error locating lessc
35+
here my lessc file locatin is /usr/bin/lessc
36+
you can find yours with this command ```which lessc```
37+
```
38+
sudo ln -s /usr/bin/lessc /usr/local/bin/lessc
39+
```
2440

25-
Portal
26-
-------
2741

28-
Enhancements:
42+
Then setup env using the following command
43+
```
44+
python3 -m venv peeljobs-env
45+
```
2946

30-
* Job Alerts
31-
* New Mobile Design
32-
* Normal Search and Advanced Search
33-
* Email Notifications
47+
Activate env with the following command
48+
```
49+
activate peeljobs-env/bin/activate
50+
```
51+
52+
Install requirements
53+
```
54+
pip install -r requirements.txt
55+
```
56+
57+
For env variables, refer to env.md for environment variables and keep those in the .env file in the current folder as your project is in.
58+
59+
Then open http://localhost:8000 in your borwser and it should work properly.
60+
61+
Run docker
62+
```
63+
docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:2.4
64+
```
3465

66+
create index
67+
```
68+
python manage.py update_index
69+
```

candidate/views.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from django.conf import settings
1212
from django.contrib.auth.decorators import login_required
1313
from django.utils import timezone
14-
from django.db.models import Q, F
14+
from django.db.models import Q
1515
from django.urls import reverse
1616
from django.template import loader, Template, Context
1717
from django.template.loader import render_to_string
@@ -94,13 +94,17 @@ def index(request):
9494
)
9595
cache.set("latest_1hr_jobs_list", latest_jobs_list, 60 * 60)
9696

97-
# latest_jobs_list = JobPost.objects.filter(status='Live').exclude(
98-
# job_type='walk-in').select_related('company', 'user').prefetch_related('location', 'skills')[:9]
97+
latest_jobs_list = (
98+
JobPost.objects.filter(status="Live")
99+
.exclude(job_type="walk-in")
100+
.select_related("company", "user")
101+
.prefetch_related("location", "skills")[:9]
102+
)
99103

100104
field = get_social_referer(request)
101105
show_pop = True if field == "fb" or field == "tw" or field == "ln" else False
102106
meta_title, meta_description, h1_tag = get_meta("home_page", {"page": 1})
103-
states = State.objects.filter(status="Enabled").exclude(state__name__in=F("name"))
107+
states = State.objects.filter(status="Enabled")
104108
data = {
105109
"jobs_list": latest_jobs_list,
106110
"show_pop_up": show_pop,

dashboard/tasks.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
from django.conf import settings
1313

1414
# from pytz import timezone
15-
from django.db.models import Q, F
15+
from django.db.models import Q
1616
from django.template import loader, Template, Context
17-
from django_blog_it.django_blog_it.models import Category, Post, Tags
1817
from django.db.models import Case, When
1918
from microurl import google_mini
2019
from twython.api import Twython
@@ -63,6 +62,7 @@ def updating_jobposts():
6362
for job in jobposts:
6463
job_url = get_absolute_url(job)
6564
job.slug = get_absolute_url(job)
65+
# job.minified_url = google_mini('https://peeljobs.com' + job_url, settings.wMINIFIED_URL)
6666
job.save()
6767

6868

@@ -196,6 +196,7 @@ def jobpost_published():
196196
job.published_on = datetime.now()
197197
job_url = get_absolute_url(job)
198198
job.slug = job_url
199+
# job.minified_url = google_mini('https://peeljobs.com' + job_url, settings.MINIFIED_URL)
199200
job.save()
200201
posts = FacebookPost.objects.filter(job_post=job)
201202
for each in posts:
@@ -726,7 +727,7 @@ def postontwitter(user, job_post, page_or_profile):
726727
for name in job_post.location.values_list("name", flat=True)
727728
]
728729
)
729-
job_name = job_name + skill_hash + loc_hash + " @Jobs @PeelJobs"
730+
job_name = job_name + skill_hash + loc_hash + " #Jobs #PeelJobs"
730731
twitter_status = (
731732
job_name + " http://peeljobs.com" + str(job_post.get_absolute_url())
732733
)
@@ -1684,7 +1685,7 @@ def sending_mobile_campaign():
16841685
message = """Top companies are looking for Java Developers!
16851686
Connect with us, to get placed https://peeljobs.com/java-fresher-jobs/
16861687
or https://goo.gl/SX4qbB"""
1687-
SMS_AUTH_KEY = "4a905d1566e5e93bfff35aa56a38660"
1688+
SMS_AUTH_KEY = settings.SMS_AUTH_KEY
16881689
BULK_SMS_FROM = "PEELJB"
16891690
requests.get(
16901691
"http://sms.9sm.in/rest/services/sendSMS/sendGroupSms?AUTH_KEY="
@@ -2081,7 +2082,7 @@ def sitemap_generation():
20812082
)
20822083
no_job_locations_fresher_jobs_xml_file.write(no_job_locations_fresher_jobs_xml_cont)
20832084

2084-
states = State.objects.filter(status="Enabled").exclude(state__name__in=F("name"))
2085+
states = State.objects.filter(status="Enabled")
20852086
states_jobs_xml_count = xml_cont
20862087
states_walkins_xml_count = xml_cont
20872088
states_fresher_jobs_xml_count = xml_cont
@@ -2496,20 +2497,20 @@ def save_search_results(ip_address, data, results, user):
24962497
# logger.debug(request_jsonized)
24972498

24982499

2499-
@task()
2500-
def handle_sendgrid_bounces():
2501-
bounces = requests.get(
2502-
"https://api.sendgrid.com/api/bounces.get.json?api_user="
2503-
+ settings.SG_USER
2504-
+ "&api_key="
2505-
+ settings.SG_PWD
2506-
)
2507-
for each in bounces.json():
2508-
user = User.objects.filter(email=each["email"]).first()
2509-
if user:
2510-
user.is_bounce = True
2511-
user.save()
2512-
user = db.users.update({"email": each["email"]}, {"$set": {"is_bounce": True}})
2500+
# @task()
2501+
# def handle_sendgrid_bounces():
2502+
# bounces = requests.get(
2503+
# "https://api.sendgrid.com/api/bounces.get.json?api_user="
2504+
# + settings.SG_USER
2505+
# + "&api_key="
2506+
# + settings.SG_PWD
2507+
# )
2508+
# for each in bounces.json():
2509+
# user = User.objects.filter(email=each["email"]).first()
2510+
# if user:
2511+
# user.is_bounce = True
2512+
# user.save()
2513+
# user = db.users.update({"email": each["email"]}, {"$set": {"is_bounce": True}})
25132514

25142515

25152516
def sending_mails_to_applicants_sendgrid():

dashboard/views.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from django.shortcuts import get_object_or_404, render
2222
from django.template import loader
2323
from django.template.defaultfilters import slugify
24-
from django_blog_it.django_blog_it.models import Post
2524
from django.core.cache import cache
2625
from microurl import google_mini
2726
from twython.api import Twython
@@ -39,7 +38,6 @@
3938
GOV_JOB_TYPE,
4039
JOB_TYPE,
4140
AppliedJobs,
42-
BlogAttachment,
4341
City,
4442
Comment,
4543
Company,
@@ -4087,6 +4085,7 @@ def edit_job_title(request, post_id):
40874085
job_post.major_skill = skill[0]
40884086
job_url = get_absolute_url(job_post)
40894087
job_post.slug = job_url
4088+
# job_post.minified_url = google_mini('https://peeljobs.com' + job_url, settings.MINIFIED_URL)
40904089
job_post.save()
40914090
if (
40924091
job_post.major_skill

env.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Environment variables guidelines
2+
- All environment variables defined below and their usage.
3+
- Kindly add below environment variables to your local development with appropriate key/value accordingly.
4+
5+
### Common keys
6+
> DEBUG=True/False
7+
> SECRET_KEY=""
8+
> HTML_MINIFY=True/False
9+
> ENV_TYPE="DEV" or "PROD"
10+
> DEFAULT_FROM_EMAIL='PeelJobs <[email protected]>'
11+
> CONTACT_NUMBER='+91 8500 099 499'
12+
> PEEL_URL="http://peeljobs.com/"
13+
> CACHE_BACKEND = "memcached://127.0.0.1:11211/"
14+
> MINIFIED_URL=''
15+
16+
### Celery keys
17+
> BROKER_API="http://guest:guest@localhost:15672/api/"
18+
> CELERY_BROKER_URL='redis://localhost:6379/1'
19+
> CELERY_RESULT_BACKEND = "redis://localhost:6379"
20+
21+
### Google authentication keys
22+
> GPCLIENTID=""
23+
> GPCLIENTSECRET=""
24+
> CLIENT_SECRET_DATA=""
25+
> GOOGLEOAUTH2REDIRECT='https://peeljobs.com/oauth2callback/'
26+
> GOOGLE_OAUTH2_REDIRECT='http://localhost:8000/oauth2callback/'
27+
28+
### Facebook keys
29+
> FBACCESSTOKEN=""
30+
> FBPAGEACCESSTOKEN=""
31+
> FBGROUPACCESSTOKEN=""
32+
> FBALLGROUPSTOKEN=""
33+
> FBDELACCESSTOKEN=""
34+
> RECFBACCESSTOKEN=""
35+
36+
### Elasticsearch keys
37+
> HAYSTACKURL='http://127.0.0.1:9200/'
38+
39+
### Postgresql DB keys
40+
> DB_NAME='peeljobs'
41+
> DB_USER='postgres'
42+
> DB_PASSWORD='root'
43+
> DB_HOST='127.0.0.1'
44+
> DB_PORT='5432'
45+
46+
### Stack Overflow keys
47+
> SOFAPPID="7099"
48+
> SOFAPPSECRET=""
49+
> SOFAPPKEY=""
50+
51+
### Github keys
52+
> GITAPPID=""
53+
> GITAPPSECRET=""
54+
> GITREDIRECTURI="http://www.peeljobs.com/social/github/"
55+
56+
### Twitter keys
57+
> twoauthtokensecret=''
58+
> twoauthtoken=''
59+
> TWAPPKEY=""
60+
> TWAPPSECRET=""
61+
> OAUTHTOKEN=''
62+
> OAUTHSECRET=''
63+
> PJTWAPPKEY=""
64+
> PJTWAPPSECRET=""
65+
66+
### Facebook Integration keys
67+
> FBAPPID=""
68+
> FBSECRET=""
69+
> FBPEELJOBSPAGEID=""
70+
71+
### Linkedin Integration keys
72+
> LNAPIKEY=""
73+
> LNSECRETKEY=""
74+
> LNCOMPANYID=""
75+
> LNOAUTHUSERTOKEN=""
76+
> LNOAUTHUSERSECRET=""
77+
78+
### Google recaptcha keys
79+
> RECAPTCHAPUBLICKEY=""
80+
> RECAPTCHAPRIVATEKEY=""
81+
82+
### Sendgrid authentication keys
83+
> SGUSER=''
84+
> SGPWD=''
85+
86+
### SMS api keys
87+
> BULKSMSUSERNAME='micropyramid'
88+
> BULKSMSPASSWORD=''
89+
> BULKSMSFROM=''
90+
> SETTINGSFILE=''
91+
> SMSAUTHKEY=''
92+
93+
### Mailgun keys
94+
> MAILGUN_API_KEY=''
95+
96+
### AWS keys
97+
> AWS_STORAGE_BUCKET_NAME=""
98+
> AWS_ACCESS_KEY=''
99+
> AWS_SECRET_KEY=''
100+
> CLOUDFRONT_DOMAIN = ""
101+
> CLOUDFRONT_ID=''
102+
> AWSENABLED=""
103+
> AWS_ACCESS_KEY_FOR_ANYMAIL_SES=""
104+
> AWS_SECRET_KEY_FOR_ANYMAIL_SES=""
105+
> AWS_LOCATION_FOR_ANYMAIL_SES=""
106+
107+
### Sentry keys
108+
> SENTRY_DSN=''
109+
110+
### Elastic APM keys
111+
> ELASTIC_APM_SERVICE_NAME=''
112+
> ELASTIC_APM_SECRET_TOKEN=''
113+
> ELASTIC_APM_SERVER_URL=''

0 commit comments

Comments
 (0)