djangogirls | Website for DjangoGirls.org | Web Site library
kandi X-RAY | djangogirls Summary
kandi X-RAY | djangogirls Summary
Website for DjangoGirls.org
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of djangogirls
djangogirls Key Features
djangogirls Examples and Code Snippets
Community Discussions
Trending Discussions on djangogirls
QUESTION
I am new to django and follow the djangogirls tutorial. With a few modifications, I am trying to get the value from the form text field and print it in view.py and then display this value again in another "result" field in the html page.
html:
...ANSWER
Answered 2021-Dec-28 at 08:09You need add method="post"
and {% csrf_token %} for your form. For example:
QUESTION
Hope, you can help me. I made a django project (just in study) and trying to deploy it with djangogirls tutorial. Okay, it works. But! When i trying to go to my website https://anle93.pythonanywhere.com, I have this:
Page not found (404) Request Method: GET Request URL: http://anle93.pythonanywhere.com/ Using the URLconf defined in personal_portfolio.urls, Django tried these URL patterns, in this order:
admin/ projects/ The empty path didn’t match any of these.
It's okay cause I havent any pages in all project. So. When i go to admin, it works(http://anle93.pythonanywhere.com/admin/login/?next=/admin/), I see username and pswd fields. AND when I try to go to my "projects" (https://anle93.pythonanywhere.com/projects/), i have this error first screen on screen. So, my project have this sctructure like on screenscreen2.2. So the question is:
I understand, that django cant find base.html file, that extends project_detail.html and project_index.html, and this is the bs4 styles for all project, not for one this app I made, so, if i wonna make any additions like, for example "project_description.html" in new app, it will extends "base.html" too. Ofc, in localhost in works like as needed. I cant understand why it happens after deploy.
...ANSWER
Answered 2021-Jul-14 at 11:47What template dir configuration do you have?
For your structure should be smth like
QUESTION
I created model Post and Comment, now I want to display comments from Post but I have a problem. In tutorial there is a line of code in html {% for comment in post.comments.all %}
but isn't working in my app. If I set {% for comment in comments %}
it works but displays all comments from models (I want only comments from the post). How to fix that? Below I pasted my code.
models.py
...ANSWER
Answered 2020-Oct-05 at 16:42In tutorial there is a line of code in html
{% for comment in post.comments.all %}
but isn't working in my app.
This is likely because they specified the related_name=…
parameter [Django-doc] in the ForeignKey
from Comment
to Post
, like:
QUESTION
I am reading through the Djangogirls.org website and they recommend Nano as the default editor when installing Git. I have also installed Visual Studio Code. I'm want to be efficient if I'm doing django and python in Visual Studio should I just use Visual Studio Code as the default editor?
This is the first time I that I'll be using Git or anything similar. It might be that I don't understand it.
...ANSWER
Answered 2020-Sep-29 at 15:01It doesn't matter... You will use the default git editor just to write your commit messages and maybe to setup an interactive rebase. For your normal work (coding, debugging etc.), you can use an IDE or every other editor you want to use.
QUESTION
Today my Heroku website was working fine but then I had to make lots of changes to the file and I definitely did something to it because now it doesn't work anymore. I don't know what could've changed the configuration.
Here is my Procfile
:
ANSWER
Answered 2020-Aug-18 at 00:54Your Procfile
is broken:
QUESTION
I know this question has been asked before, but either I don't understand how to apply the solutions provided or they don't work. I think my case may be much simpler.
I am a beginner with Django and I'm following first the djangogirls tutorial. I installed Django in a virtual environment that I created with conda
. The first time I tried it, I was perfectly able to create a superuser and log in to the account successfully. However, that time I created the project in C:\Users\User\
and it was not very organized since there were a whole lot of files and folders there along with the project.
Now, I created a second virtual environment and a new project, which is in F:, another partition of the same drive. I did everything I had done the first time, but when I tried to log in to the admin page, I get a message saying the credentials are incorrect. Actually, I created other two superusers (successfully), but always get the same message.
I also created a third virtual environment and project (in the same partition where the OS is not), this time with pip, to follow exactly the same process in the djangogirls tutorial. However, the exact same thing happened. I thought maybe, for the project with the virtual environment created with conda
, the project had to be in the same partition as the OS, which is why I created a third project using the same virtual environment but in the C drive. Always the same error.
I tried creating a new superuser for the very first app I was creating (the one that wasn't organized), and it was created successfully and I was able to log in successfully too.
From all the answers I have read, there might be something wrong with the database, but I don't understand how to apply those solutions.
I'm using Windows 10. Python 3.7.6 and Django 3.0.3.
EDIT 1
The exact steps I'm following (and their order) are the following:
- Create project with
django-admin.exe startproject myproject .
in a dedicated directory in the drive F (partition. Windows is in C).
In the settings.py file, change the time zone, add the path for static files with
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
, changeALLOWED_HOSTS
value withALLOWED_HOSTS = ['127.0.0.1', '.pythonanywhere.com']
, as the tutorial specifies.I'm using the default sqlite3, and setting it up with
python manage.py migrate
After this I run the server and everything looks great so far.
- Create the application with
python manage.py startapp blog
as the tutorial specifies.
- Add the app to the
INSTALLED_APPS
variable
ANSWER
Answered 2020-Jun-07 at 20:19I got a lot of help from a user named Lowe Wilsson in a chat room dedicated to the djangogirls tutorial and that led to a solution to the problem.
The problem was—most likely—that one of the times I ran the server for the first project I created I didn't shut it down properly—closing the terminal window without stopping the server—and it kept running in the background, so every time I went to 127.0.0.1:8000 I was interacting with the first project's database. This explains why I could log in with the admin credentials for that first project even when I ran the server for another project.
Doing
QUESTION
I have tried to learn like this. And try to develop my blog and add SLUG to the function But it is not possible to add new posts at all Do you have a solution or a way to make it work?
https://tutorial.djangogirls.org/en/django_forms/
on Models like this.
...ANSWER
Answered 2020-May-04 at 10:16For your 'create_post'
path, the will first capture this, since
createcontent
is a valid slug as well. Therefore you should alter the urlpatterns
. You can swap the two:
QUESTION
I have a Django website, and I'm making a call to Etsy's API in order to display products on the website. The data has multiple levels (abbreviated below):
...ANSWER
Answered 2020-May-03 at 17:48The problem is that the images are not directly under results
, but they are part of each item, at the same level as title
and price
. There can also be multiple images so I'm assuming here you just want the first one for each product.
So instead you want something like:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install djangogirls
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page