Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug app #10

Merged
merged 62 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
c790114
added the models for the bug app
ikeadeoyin Jan 25, 2024
9bc8a77
updated CapX settings with media directory
ikeadeoyin Feb 7, 2024
ce4b5af
updated the null and blank options on bug_type and status to True
ikeadeoyin Feb 7, 2024
d5b0989
added the url for the bugs app
ikeadeoyin Feb 7, 2024
9fbc7c8
updated the admin view to show the bug and attachments together
ikeadeoyin Feb 7, 2024
b465c91
views for the bug app
ikeadeoyin Feb 7, 2024
2eca1e9
form the bugs app
ikeadeoyin Feb 7, 2024
f1fd482
url for the bugs app
ikeadeoyin Feb 7, 2024
465aea9
html templates for the bugs app
ikeadeoyin Feb 7, 2024
a83bae5
migrations
ikeadeoyin Feb 7, 2024
8a774ba
updated the bug list views
ikeadeoyin Feb 13, 2024
201b663
Merge branch 'main' into bug-app
albertoleoncio Feb 13, 2024
6863749
made changes
ikeadeoyin Feb 13, 2024
0ffa325
add the media folder to gitignore
ikeadeoyin Feb 13, 2024
c9be2c5
Fixing rebase
albertoleoncio Feb 13, 2024
ed19d88
+some styles at register_bug.html
albertoleoncio Feb 13, 2024
d9777ba
updated the feedback tab link
ikeadeoyin Feb 20, 2024
45f5034
added links to update an delete a bug
ikeadeoyin Feb 20, 2024
b003917
added urls to update and delete a bug
ikeadeoyin Feb 20, 2024
c987a66
added the flash message
ikeadeoyin Feb 20, 2024
0f94080
added links to update and delete a bug
ikeadeoyin Feb 20, 2024
befdb5a
template to update a bug
ikeadeoyin Feb 20, 2024
624cfe8
added the views to update and delete a bug
ikeadeoyin Feb 20, 2024
d84d239
Merge branch 'bug-app' of https://github.com/WikiMovimentoBrasil/capx…
ikeadeoyin Feb 20, 2024
ae612eb
Merge branch 'main' into bug-app
albertoleoncio Feb 21, 2024
dff4578
added link to add a bug
ikeadeoyin Feb 21, 2024
d579ea8
views documentation
ikeadeoyin Feb 23, 2024
c46ccb8
tests for the bug app
ikeadeoyin Feb 26, 2024
0e71f8c
added test for the bug app views
ikeadeoyin Feb 29, 2024
3d9b600
Merge branch 'main' into bug-app
albertoleoncio Feb 29, 2024
4a225a3
made changes to the test
ikeadeoyin Feb 29, 2024
f479363
added bug_form_url
ikeadeoyin Feb 29, 2024
2ddfa2f
made changes
ikeadeoyin Feb 29, 2024
bbd3e0a
made changes
ikeadeoyin Feb 29, 2024
ea08312
made changes
ikeadeoyin Feb 29, 2024
eeb9868
made changes
ikeadeoyin Feb 29, 2024
161be70
made changes
ikeadeoyin Feb 29, 2024
89307ac
made changes
ikeadeoyin Feb 29, 2024
d71c1f6
made changes
ikeadeoyin Feb 29, 2024
fea479c
made changes
ikeadeoyin Feb 29, 2024
5a92a50
made changes
ikeadeoyin Feb 29, 2024
2c62c0f
made changes
ikeadeoyin Feb 29, 2024
40f6cf9
made changes
ikeadeoyin Feb 29, 2024
2094db3
made changes
ikeadeoyin Feb 29, 2024
995d194
added tests
ikeadeoyin Feb 29, 2024
b71337d
made changes
ikeadeoyin Feb 29, 2024
80bfeb1
made changes
ikeadeoyin Feb 29, 2024
8d5ef7b
made changes
ikeadeoyin Feb 29, 2024
7a2cfc3
made changes
ikeadeoyin Feb 29, 2024
8bd9270
made changes
ikeadeoyin Feb 29, 2024
18b14d2
made changes
ikeadeoyin Feb 29, 2024
5dd6403
made changes
ikeadeoyin Feb 29, 2024
be7f4dd
made changes
ikeadeoyin Feb 29, 2024
020c241
made changes
ikeadeoyin Feb 29, 2024
1c32741
made changes
ikeadeoyin Feb 29, 2024
ab7b0c1
made changes
ikeadeoyin Feb 29, 2024
4d3135c
made changes
ikeadeoyin Feb 29, 2024
487db74
made changes
ikeadeoyin Feb 29, 2024
4228ba1
made changes
ikeadeoyin Feb 29, 2024
3a495e2
made changes
ikeadeoyin Feb 29, 2024
10eb9c6
made changes
ikeadeoyin Feb 29, 2024
0114897
made changes
ikeadeoyin Mar 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixing rebase
  • Loading branch information
albertoleoncio committed Feb 13, 2024
commit c9be2c5be2f7c4ff2b879c8824e990d12bc82078
15 changes: 14 additions & 1 deletion .github/workflows/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ jobs:
max-parallel: 4
matrix:
python-version: [3.9]

services:
elasticsearch:
image: elasticsearch:7.16.3
ports:
- 9200/tcp
options: -e="discovery.type=single-node" --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -25,12 +30,20 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Verify Elasticsearch connection from host
env:
ELASTIC_SEARCH_URL: http://localhost:${{ job.services.elasticsearch.ports[9200] }}
run: |
echo $ELASTIC_SEARCH_URL
curl -fsSL "$ELASTIC_SEARCH_URL/_cat/health?h=status"
- name: Create settings_local.py
run: |
echo "SECRET_KEY = 'SECRET_KEY'" > CapX/settings_local.py
echo "DEBUG = True" >> CapX/settings_local.py
echo "ALLOWED_HOSTS = ['localhost', '127.0.0.1']" >> CapX/settings_local.py
echo "BASE_DIR = '${GITHUB_WORKSPACE}'" >> CapX/settings_local.py
echo "DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'db.sqlite3'}}" >> CapX/settings_local.py
echo "ELASTICSEARCH_DSL = {'default': {'hosts': 'http://localhost:${{ job.services.elasticsearch.ports[9200] }}'}}" >> CapX/settings_local.py
- name: Coverage report
run: |
pip install coverage
Expand Down
22 changes: 22 additions & 0 deletions CapX/search.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from django.http import HttpResponseServerError
from django.shortcuts import render
from elasticsearch.exceptions import ConnectionError
from users.documents import ProfileDocument
from skills.documents import SkillDocument

def search(request):
query = request.GET.get('query', '')
try:
users_results = ProfileDocument.search().query('fuzzy', user__username=query).execute()
skills_results = SkillDocument.search().query('fuzzy', skill_name=query).execute()
return render(request, 'search.html', {
'users_results': users_results,
'skills_results': skills_results,
'query': query
})
except ConnectionError as e:
error_message = f"Error connecting to Elasticsearch: {str(e)}"
return render(request, 'search.html', {
'error_message': error_message,
'query': query
})
3 changes: 2 additions & 1 deletion CapX/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
'django.contrib.messages',
'django.contrib.staticfiles',
'social_django',
'modeltranslation'
'modeltranslation',
'django_elasticsearch_dsl'
]

MIDDLEWARE = [
Expand Down
28 changes: 26 additions & 2 deletions CapX/settings_local_example.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import os
import configparser
from pathlib import Path
from django.utils.translation import gettext_lazy as _

SECRET_KEY = '<YOUR VERY SECRET KEY>'
DEBUG = False
DEBUG = True #Change to False when in production
ALLOWED_HOSTS = ['<YOUR HOSTS>']

HOME = os.environ.get('HOME') or ""

SOCIAL_AUTH_MEDIAWIKI_KEY = '<YOUR MEDIAWIKI KEY>'
Expand All @@ -15,6 +19,8 @@
if os.path.exists(replica_path):
config = configparser.ConfigParser()
config.read(replica_path)
elasticsearch = configparser.ConfigParser()
elasticsearch.read(HOME + '/.elasticsearch.ini')

DATABASES = {
'default': {
Expand All @@ -26,11 +32,29 @@
'PORT': '',
}
}
ELASTICSEARCH_DSL={
'default': {
'hosts': 'http://elasticsearch.svc.tools.eqiad1.wikimedia.cloud:80',
'http_auth': (elasticsearch['username'] , elasticsearch['password'])
}
}
else:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
ELASTICSEARCH_DSL={
'default': {
'hosts': 'http://localhost:9200'
}
}
print('replica.my.cnf file not found')

LANGUAGES = (
('en', _('English')),
('pt-br', _('Brazilian Portuguese')),
('pt', _('Portuguese')),
('es', _('Spanish')),
)
3 changes: 3 additions & 0 deletions CapX/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
from django.urls import path, include
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls.static import static
from .search import search

urlpatterns = [
path('admin/', admin.site.urls),
path('search/', search, name='search'),
path('', include('users.urls')),
path('', include('skills.urls')),
path('', include('social_django.urls')),
path('bugs/', include('bugs.urls'))
]
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,19 @@ Before you begin, ensure you have met the following requirements:

- Python 3
- Django 4.2.5
- MySQL

### Installation

1. Clone the repository:

```bash
git clone https://github.com/WikiMovimentoBrasil/capx.git
https://github.com/WikiMovimentoBrasil/capx-dev.git

2. Navigate to the project directory:

```bash
cd capx
cd capx-dev

3. Create a virtual environment (optional but recommended):

Expand Down Expand Up @@ -64,6 +65,11 @@ Before you begin, ensure you have met the following requirements:
8. Install initial data:
``` bash
python manage.py loaddata fixtures/initial_data.json
python manage.py loaddata users/fixtures/region.json
python manage.py loaddata users/fixtures/language.json
python manage.py loaddata users/fixtures/organizationType.json
python manage.py loaddata users/fixtures/organization.json


9. Start the development server:
```bash
Expand Down
Loading
Loading