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
Yay! 🤗
Your post has been boosted with Ecency Points, by @penderis.
Use Ecency daily to boost your growth on platform!
Support Ecency
Vote for Proposal
Delegate HP and earn more