Closed taljacob2 closed 2 years ago
Hi @taljacob2, The new arrangement that you suggest looks awesome. I'll make it happen, but Iβm thinking to make #20 a draft for now and do the new arrangement in a new PR.
Hi @taljacob2, The new arrangement that you suggest looks awesome. I'll make it happen, but Iβm thinking to make #20 a draft for now and do the new arrangement in a new PR.
Sounds great! :+1:
Thanks for @paOmer for excellent work! Each team member can now create his own "feature"-app based on #34.
@ShirleyFichman @paOmer @DeanBiton @amittcohen
Say YOUR_FEATURE_APP_NAME is one of the following names:
templates/YOUR_FEATURE_APP_NAME
folder in your "feature"-app, and place there all your .html
files.
(For example: YOUR_FEATURE_APP_NAME.html
)app/settings.py
, and in line 60 add your templates folder to your "feature"-app you have created.
For example: (added the line: os.path.join(BASE_DIR, 'YOUR_FEATURE_APP_NAME', 'templates', 'YOUR_FEATURE_APP_NAME')
)
'DIRS': [os.path.join(BASE_DIR, 'templates'),
os.path.join(BASE_DIR, 'jobseeker', 'templates', 'jobseeker'),
os.path.join(BASE_DIR, 'YOUR_FEATURE_APP_NAME', 'templates', 'YOUR_FEATURE_APP_NAME')],
To render a .html
, navigate to YOUR_FEATURE_APP_NAME/views.py
, and make it look like so: (for example)
from django.shortcuts import render
def YOUR_FEATURE_APP_NAME(request):
return render(request, 'YOUR_FEATURE_APP_NAME.html')
Render your "feature"-app URLs by creating a YOUR_FEATURE_APP_NAME/urls.py
file, with the following content:
from django.urls import path
from . import views
urlpatterns = [
path('YOUR_FEATURE_APP_NAME/', views.YOUR_FEATURE_APP_NAME, name='YOUR_FEATURE_APP_NAME'),
]
Make sure jobseeker/urls.py
is rendering your YOUR_FEATURE_APP_NAME/urls.py
.
You need to enable the path
to YOUR_FEATURE_APP_NAME/urls.py
in the jobseeker/urls.py
file:
from django.urls import path, include
from . import views
urlpatterns = [
path('about/', views.about, name='about'),
path('', include('YOUR_FEATURE_APP_NAME.urls')),
]
.html
of your "feature"-app can be accessed at: http://localhost:8000/YOUR_FEATURE_APP_NAME/
Hi all! π₯ π All of our 5 "feature"-apps will make use of some "global" files. For example:
base_template.html
,icons
foldermain.css
and more...We should arrange our Django Application such that the
jobseeker
-app is a "global" app that is being injected into each "feature"-app. This way, we could make use of "global" shared files together in a modular way!This is the Django Application Rendering Flow that will help us share data between our "feature"-apps:
Practically said, the way to create this modular structure is by doing the following:
Urls
[x]
app/urls.py
should look like so:[x]
jobseeker/urls.py
should look like so:Templates
jobseeker/templates
folder that contains:base_template.html
.Static
jobseeker/static
folder that contains:main.css
main_logo.png
icons
facebook.svg
instagram.svg
twitter.svg