Skip to content

Commit

Permalink
Merge branch 'main' into app_users
Browse files Browse the repository at this point in the history
  • Loading branch information
anaisrandria authored Dec 9, 2024
2 parents 63f4891 + 2c7194b commit 078dd2d
Show file tree
Hide file tree
Showing 37 changed files with 3,334 additions and 17 deletions.
171 changes: 166 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,167 @@
.DS_Store
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
my_venv/*
*/*/__pycache__/
*/*/*/__pycache__/
node_modules
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

.DS_Store

microblogging/my_venv/
microblogging/users_app/frontend/.vite/
7 changes: 5 additions & 2 deletions microblogging/microblogging_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
# 'rest_framework',

'users_app',
]
Expand All @@ -71,14 +71,15 @@
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [os.path.join(BASE_DIR, 'microblogging_project/views/templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.static',
],
},
},
Expand Down Expand Up @@ -137,6 +138,8 @@
# https://docs.djangoproject.com/en/4.2/howto/static-files/

STATIC_URL = 'static/'
STATIC_ROOT = BASE_DIR / 'staticfiles'
STATICFILES_DIRS = [BASE_DIR / "../microblogging/users_app/frontend/dist"]

# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
Expand Down
9 changes: 6 additions & 3 deletions microblogging/microblogging_project/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from users_app import views

urlpatterns = [
path('admin/', admin.site.urls),
path('', views.index, name='index'),
path('users', views.users, name='users'),
path('index', views.index, name='index'),
path('fetch-users/', views.fetch_users, name='fetch_users'),
path('insert-user/', views.insert_user, name='insert_user'),
]
] + static(settings.STATIC_URL, document_root=settings.STATICFILES_DIRS[0])
6 changes: 6 additions & 0 deletions microblogging/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
41 changes: 41 additions & 0 deletions microblogging/users_app/fixtures/sample-posts-tags.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[{
"model": "users_app.post_tags",
"pk": 1,
"fields": {
"post_id": 1,
"tag_id": 2
}
},
{
"model": "users_app.post_tags",
"pk": 2,
"fields": {
"post_id": 2,
"tag_id": 3
}
},
{
"model": "users_app.post_tags",
"pk": 3,
"fields": {
"post_id": 3,
"tag_id": 4
}
},
{
"model": "users_app.post_tags",
"pk": 4,
"fields": {
"post_id": 4,
"tag_id": 4
}
},
{
"model": "users_app.post_tags",
"pk": 5,
"fields": {
"post_id": 5,
"tag_id": 1
}
}
]
57 changes: 57 additions & 0 deletions microblogging/users_app/fixtures/sample-posts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[
{
"model": "users_app.post",
"pk": 1,
"fields": {
"user": 1,
"content": "Learning Django ORM is fun!",
"parent_id": null,
"created_at": "2024-12-04T08:30:00Z",
"updated_at": "2024-12-04T08:30:00Z"
}
},
{
"model": "users_app.post",
"pk": 2,
"fields": {
"user": 2,
"content": "Exploring the beauty of the mountains.",
"parent_id": null,
"created_at": "2024-12-04T09:30:00Z",
"updated_at": "2024-12-04T09:30:00Z"
}
},
{
"model": "users_app.post",
"pk": 3,
"fields": {
"user": 5,
"content": "Top 10 travel tips for 2024.",
"parent_id": null,
"created_at": "2024-12-04T10:30:00Z",
"updated_at": "2024-12-04T10:30:00Z"
}
},
{
"model": "users_app.post",
"pk": 4,
"fields": {
"user": 1,
"content": "Can’t wait to start the new project!",
"parent_id": null,
"created_at": "2024-12-05T11:00:00Z",
"updated_at": "2024-12-05T11:00:00Z"
}
},
{
"model": "users_app.post",
"pk": 5,
"fields": {
"user": 2,
"content": "What are your favorite Django packages?",
"parent_id": 1,
"created_at": "2024-12-05T12:00:00Z",
"updated_at": "2024-12-05T12:00:00Z"
}
}
]
14 changes: 14 additions & 0 deletions microblogging/users_app/fixtures/sample-tags.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{"model": "users_app.tag",
"pk": 1,
"fields": {"tag" : "#lovereading"}},
{"model": "users_app.tag",
"pk": 2,
"fields": {"tag" : "#horrostory"}},
{"model": "users_app.tag",
"pk": 3,
"fields": {"tag": "#romance"}},
{"model": "users_app.tag",
"pk": 4,
"fields": {"tag": "#booklover"}}
]
26 changes: 26 additions & 0 deletions microblogging/users_app/fixtures/sample-users.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{
"model": "users_app.user",
"pk": 1,
"fields": {
"email": "[email protected]",
"username": "alice",
"password": "hashed_password_1",
"bio": "Software engineer and cat lover.",
"created_at": "2024-12-01T10:00:00Z",
"updated_at": "2024-12-01T10:00:00Z"
}
},
{
"model": "users_app.user",
"pk": 2,
"fields": {
"email": "[email protected]",
"username": "bob",
"password": "hashed_password_2",
"bio": "Photography enthusiast.",
"created_at": "2024-12-02T11:00:00Z",
"updated_at": "2024-12-02T11:00:00Z"
}
}
]
Loading

0 comments on commit 078dd2d

Please sign in to comment.