Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

sarahboyce/PyCharm-Django-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test Django project for endpoints and Django Structure

This project is roughly the Django REST Framework quickstart tutorial.

Tested on PyCharm 2023.3.4 and this project has no views in Django Structure and no endpoints detected.

These endpoints are expected:

Endpoint View URL Name
/ rest_framework.routers.APIRootView api-root
/api-auth/login/ django.contrib.auth.views.LoginView rest_framework:login
/api-auth/logout/ django.contrib.auth.views.LogoutView rest_framework:logout
/groups/ accounts.views.GroupViewSet group-list
/groups/<int:pk>/ accounts.views.GroupViewSet group-detail
/users/ accounts.views.UserViewSet user-list
/users/<int:pk>/ accounts.views.UserViewSet user-detail

The user and group ones are defined in the project and I would expect them to be picked up.

Test Project Set up

Set up for virtual environment

pip install -r requirements.txt

Enable PyCharm Django support.

As I have committed a SQLite database you shouldn't need to migrate.

Run a server

python manage.py runserver

Test the api

curl -u admin -H 'Accept: application/json; indent=4' http://127.0.0.1:8000/users/

It will say: Enter host password for user 'admin': Password is test12345

Response:

[
    {
        "url": "http://127.0.0.1:8000/users/1/",
        "username": "admin",
        "email": "[email protected]",
        "groups": []
    }
]

You can also see the list of urls by running:

python manage.py show_urls

Which is a django-extensions helper function.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages