Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMirko Xiang Zhao
17,787 PointsAdmin page lost css after including STATICFILES_DIRS = { os.path.join(BASE_DIR, 'assets') } [SOLVED]
After I include the setting STATICFILES_DIRS = { os.path.join(BASE_DIR, 'assets') }
I tried to log in to the Admin page but it just became a plain html construction loosing all the css and throwing an error stating it couldn't find the css files.
If I remove the above lines all works again.
Any help is highly appreciated, I am completing the tutorial on my own machine. Cheers,
Mirko
3 Answers
Mirko Xiang Zhao
17,787 Points[SOLVED] I just modified that line to include the admin css dir as follows: STATICFILES_DIRS = [ os.path.join(BASE_DIR, "assets"), '/static/admin', ]
not sure if it's not recommended but it appears to work now :)
Chris Freeman
Treehouse Moderator 68,457 Pointsmoved to answer. Marked Best Answer.
Daniel Jeffery
1,572 PointsThe issue is that you've used a dictionary instead of a tuple!
As you have noted a list also works, but in Kenneth's example he uses a tuple.
If you think about how a dictionary works, you will see why it didn't get the desired result in this case.
Sameer Zahid
5,967 PointsThe actual code in the video is this:
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'assets'),
)
Notice that it is a tuple with regular brackets and not curly. Also since it is a tuple, you can't skip the comma at the end, ie. the comma is compulsory and not optional, in fact that is what makes it a tuple.
Chris Komaroff
Courses Plus Student 14,198 PointsChris Komaroff
Courses Plus Student 14,198 PointsHi, I don't get this problem, admin looks okay, but not sure I understand your issue.