Documenting Working Codes - A Django Setup Routine that actually Works
My very first take on programming went like this:
Spent the whole day stuck on starting up a freaking django app
I ran this same shit yesterday and everything went well in the end.
And it went like that for a reason.
Whatever, we correcting that shit.
Systems over goals.
Tried to create multiple django projects multiple times today and got a hang of it.
Creating a Django Project, App and running it Till the apps.views return the desired output (Without PipEnv)
Create a django project using 'django-admin startproject projectName'
Run the manage.py server using 'python manage.py runserver'. If you are not sure whether you in the right directory, type 'dir' into the command line and hit enter. If manage.py shows up as one of the files in that directory, you good to go.
Create an app inside the project by using 'python manage.py startapp appName'
*Now, one of the most frustrating thing I have ever faced since starting django is how I went from easily creating a project that at least take me all the way to the admin page to the one that continuously show me this:
After battling with it, I discovered the singular reason why that happens:
Not migrating means you will never SEE the ADMIN page!
- Migrate using 'python manage.py migrate'
To be able to login through the admin page, create super user. With 'python manage.py createsuperuser'
add newly created app to INSTALLED APPS in settings.py
Create urls.py for the app
Copy the main project's urls.py and copy it to the newly created app's urls.py then tweak it by by adding especially 'from . import views' ie import app.views into the app
Go to the newly created app's views.py and create exactly what you want the user to see
END
Stack Used: python 3.7; django 3.2
Leave Documenting Working Codes - A Django Setup Routine that actually Works to:
Read more #python posts
Best Posts From HolyBranches
We have not curated any of holybranches's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From HolyBranches
- Trying to Manually set up a virtual environment with pipenv
- Documenting Working Codes: Re-Establishing The Fact That We Must Pipenv-Install Django Everytime We Create A New Project Inside The Directory Containing That New Project
- Documenting Working Codes: Must we pipenv-install django everytime we start a new project?
- Documenting Working Codes: Path and PipEnv
- Documenting Working Codes - A Django Setup Routine that actually Works
- Documenting Working Codes - Windows Powershell Trash?
- Documenting Working Codes - Django Setup
- A Hermit's Opinion - 3
- A Hermit's Opinion - 2
- A Hermit's Opinion - 1