create account

Documenting Working Codes - A Django Setup Routine that actually Works by holybranches

View this thread on: hive.blogpeakd.comecency.com
· @holybranches ·
$2.07
Documenting Working Codes - A Django Setup Routine that actually Works
My very first take on programming went like this:

<i>Spent the whole day stuck on starting up a freaking django app</i>
<i>I ran this same shit yesterday and everything went well in the end.</i>

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.

<h6>Creating a Django Project, App and running it Till the apps.views return the desired output (Without PipEnv) </h6>

1. Create  a django project using 'django-admin startproject <i>projectName</i>'

2. 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.

3. Create an app inside the project by using 'python manage.py startapp <i>appName</i>'

*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:


![Screenshot (281).png](https://images.hive.blog/DQmZz5kBrUJLbA6bteS9mjWvVwVJ8XpUkyzssoeGCf8JJLA/Screenshot%20(281).png)


After battling with it, I discovered the singular reason why that happens:

<h5>Not migrating means you will never SEE the ADMIN page!</h5>

4. Migrate using 'python manage.py migrate'


![Screenshot (282).png](https://images.hive.blog/DQmVxuMPJWrTZthLj4rPwTTY117NVkRawAZF8afjMdcKx5R/Screenshot%20(282).png)


5. To be able to login through the admin page, create super user. With 'python manage.py createsuperuser'

6. add newly created app to INSTALLED APPS in settings.py

7. Create urls.py for the app

8. 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

9. Go to the newly created app's views.py and create exactly what you want the user to see

<h5>END</h5>

<sub><i>Stack Used: python 3.7; django 3.2</i></sub>
👍  , , , , , , , , , , , , ,
properties (23)
authorholybranches
permlinkdocumenting-working-codes-a-django-setup-routine-that-actually-works
categorypython
json_metadata{"tags":["python","programming","django","setup","issues"],"image":["https://images.hive.blog/DQmZz5kBrUJLbA6bteS9mjWvVwVJ8XpUkyzssoeGCf8JJLA/Screenshot%20(281).png","https://images.hive.blog/DQmVxuMPJWrTZthLj4rPwTTY117NVkRawAZF8afjMdcKx5R/Screenshot%20(282).png"],"app":"hiveblog/0.1","format":"markdown"}
created2021-04-29 20:41:21
last_update2021-04-29 20:41:21
depth0
children1
last_payout2021-05-06 20:41:21
cashout_time1969-12-31 23:59:59
total_payout_value1.074 HBD
curator_payout_value0.991 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,100
author_reputation8,432,821,397,316
root_title"Documenting Working Codes - A Django Setup Routine that actually Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id103,380,006
net_rshares3,008,129,651,495
author_curate_reward""
vote details (14)
@ecency ·
**Yay!** 🤗<br>Your post has been **boosted with Ecency Points**, by @penderis. <br>Use Ecency daily to boost your growth on platform! <br><br><b>Support Ecency</b><br>[Vote for Proposal](https://hivesigner.com/sign/update-proposal-votes?proposal_ids=%5B141%5D&approve=true)<br>[Delegate HP and earn more](https://ecency.com/hive-125125/@ecency/daily-100-curation-rewards)
properties (22)
authorecency
permlinkre-2021429t224950533z
categorypython
json_metadata{"tags":["ecency"],"app":"ecency/3.0.5-welcome","format":"markdown+html"}
created2021-04-29 22:49:51
last_update2021-04-29 22:49:51
depth1
children0
last_payout2021-05-06 22:49:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length371
author_reputation613,589,286,978,643
root_title"Documenting Working Codes - A Django Setup Routine that actually Works"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id103,381,865
net_rshares0