Naggafin
do your standard install command for python3 and python3-venv. on a Debian type distro this'll be something like:
sudo apt-get install python3 python3-venv
Naggafin
those might not be the exact package names, so if it gives you an error about not finding them, just Google what they should be for your distro
Nour
I typed python --version
And its 3.8.10
Nour
And the system accepted my venv
Naggafin
perfect
Naggafin
now you can do this:
python3 -m venv <path/to/your/project/folder>
example:
python3 -m venv /home/username/myproject/venv
Naggafin
that will setup a python virtual environment in your project dir, where you can keep all your dependencies w/ your proj
Naggafin
when you've got your venv established you can utilize is with the . or source command. e.g.: . /home/username/myproject/venv/bin/activate
Naggafin
wherever you saved it, just append "/bin/activate" to the path for that command
Nour
Naggafin
OK. do you have pip installed? if not:
curl -Ss https://bootstrap.pypa.io/get-pip.py | python3
Nour
Nour
Could it be the wsgi file in pythonanywhere?
Naggafin
huh. so you're saying django does show as installed w/ pip's output while your virtualenv is active?
Nour
Naggafin
I am not familiar with pythonanywhere though. but wow, that is very bizarre. in the stack trace (I'm assuming python is spitting out some import error), can you see which module tried to import django but failed?
Vitaly
Sup, how to use some form in func in many hmtl? or how to force class in view see func out of class?)
I Created header and one more form. One page can see that, but others don't. I working on that about 10 hours already -_-
not calling the answer, some link on docks can help
The Inspired
The Inspired
as a context
Vitaly
The Inspired
The Inspired
you just create a class to which you pass an argument 'form_class=(your form class name)'
Vitaly
The Inspired
from there on, you can either pass your form to every class you want, using the same 'form_class=()' attribute.... or subclass the class which has your form
Vitaly
The Inspired
👍
Carolyn
Hi
I have a program which the django can receive some words from the front end and its gonna do some web scrapping with those words and it’s gonna take a while to complete each one
so I want to show a progress bar or a percentage on the front end that indicates how much of the words have been analyzed or processed
How can I do this?
Gregory
Sofia
Hello, I want to create a Merchant user and give it some permission. but I don't know how to create a MerchantUser model and If the Customer user at the same time is a Merchant user too. how its works. Please anyone suggest to me a way.
Anonymous
not help)
Sure it doesn't, it's old version of Django
Anonymous
Arstanova
Why is the data not being retrieved from the database?
Arstanova
'''
def index(request):
setting = Setting.objects.get(pk=1)
context = {
setting : 'setting',
}
return render(request , 'index.html' , context)
'''
Arstanova
views.py
Arstanova
<img class='tn-atom__img t-img' data-original='{{ setting.logo.url }}'>
Arstanova
index.html
Arstanova
for example, I want to display a logo or text from the database, but I get nothing in response
finegorko
show model
Arstanova
the problem is in jinja or in the version in django i have 4.1 right now ?
Arstanova
Linkode created i09TNSqf2nPl5AyDEt4VG6
Maxim
Ali
Arstanova
aa thanks
Akhil
Hi Team, is anyone aware how to monitor gunicorn not releasing memory..we have py django setup and gunicorn threads do not appear to release memory..is there anyone way to prevent?
Iñaki
I need change the reference foreign key to this
Bhaghi
Hi
In my django project iam connected to my SQL database base iam added one field in database but not update in admin page and also web page
How can added the admin page web page. Field
Mihir
i have created form where i have kept multiple checkbox select option for few fields, but my problem is that when i save it in database, it saves in database as well as it also renders the value , but when i open form for update it does not come selected.
Sahil
Manheevak
Sahil
adilet
i can delete one field from nested serializer?
Alejandro Marín 🇵🇾
Hi, can i share my database data to another member of my team using Postgress as the database?
The Inspired
Ashish
Good evening sir and ma'am,i am new in python,so i started learning so,i got to know there is flask and django two framework,but i saw that that admin panel comes there with main websites in django,but in flask there only websites,so i want to know that,admin panel also comes there for websites,or we have to create our own self to link with our main website
Ashish
Yes,i am asking
Ashish
Admin panel comes already in flask like we get in django,so it directly connects with our main websites,here in django we don't create admin panel,it's already built,so i want to know that,we have to create admin from our self in flask to connect with our flask websites
Ashish
I didn't understand your mean sir
Ashish
Can you clear me?
Ashish
Okay,so we have to create it
Seun
Hi.
Please I'm trying to update a user model but the update form is not pre populated.
Yet no exceptions raised
Manheevak
Seun
Share code
forms.py
User = get_user_model()
class AgentCreationForm(forms.ModelForm):
class Meta:
model = User
fields = (
'email',
'username',
'first_name',
'last_name'
)
Seun
models.py:
class Agent(models.Model):
#creating an agent with a registered user
user = models.OneToOneField(User, on_delete=models.CASCADE)
# we are managing agents under the managed by
managed_by = models.ForeignKey(UserProfile, on_delete=models.CASCADE)
def str(self):
return self.user.username
Seun
Share code
Views.py
class AgentUpdateView(ManagementAndLoginRequiredMixin, UpdateView):
form_class = AgentCreationForm
template_name = 'agents/agent_update.html'
def get_queryset(self):
logged_in_management = self.request.user.userprofile
return Agent.objects.filter(managed_by = logged_in_management)
def get_success_url(self):
return reverse('agent_list')
Flam
Seun
Flam
Seun
MR
Can any one provide python backend code for CRUD operations
For library management system project
Charly
Charly
MR
I don't need entire project i just need backend code
Charly
MR
🤦ok
X_ShaygaN_D
Hi there,
I've created a Profile model with a OneOneToOneField to Django's user model, The Profile model also has a slug which is used for the page to edit the profile.
Now, I'm trying to create an Edit User page where you can change first and last name, email, username and password.
I tried creating that using an UpdateView, But I don't want to pass in the pk, I want the URLconf to include the slug for the User, I tried accessing user.profile.slug but it returns the string and not the field itself.
How can I do that? I'm totally stuck, This is the first time that I can't find a single result.
Here's a link to the stackoverflow post if you want to access the code and more info
adilet
is it possible to login with nfc in django rest?