#Ubuntu/Django

1 messages ยท Page 1 of 1 (latest)

clear lichen
#

my server and site are working

#

except the images

short drum
#

Can you show your nginx configuration?
What are you running django application through? (gunicorn, runserver...?)
What user is running the process that's hosting the django app?
What are the permissions on the folder that contains the images?

clear lichen
#

gunicorn

#

i gave all permissions to the folder that contains the images

#

let me show you

#

server {
listen 80;
listen [::]:80;
server_name 35.180.100.66;

Add index.php to the list if you are using PHP

index index.html index.htm index.nginx-debian.html index.php;

ATTENTION: /home/ubuntu/jogo/project/static

location /static {
autoindex on;
alias /home/ubuntu/jogo/project/static;
}

ATTENTION: /home/ubuntu/jogo/project/media

location /media {
autoindex on;
alias /home/ubuntu/jogo/project/media;
}

ATTENTION: agenda

location / {
proxy_pass http://unix:/run/agenda.socket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}

deny access to .htaccess files, if Apache's document root

concurs with nginx's one

gzip on;
gzip_disable "msie6";

gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_proxied any;
gzip_types
text/plain
text/css
text/js
text/xml
text/javascript
application/javascript
application/x-javascript
application/json
application/xml
application/rss+xml
image/svg+xml;

access_log off;
#access_log /var/log/nginx/35.180.100.66-access.log;
error_log /var/log/nginx/35.180.100.66-error.log;
}

where it says "jogo" actually means django agenda dont worry about it since i changed in vs code to jogo

clear lichen
#

ubuntu@ip-xxxxxxxxxxxx:~$ whoami
ubuntu

#

ls -l /home/ubuntu/django_agenda/static/
total 8
drwxrwxrwx 5 ubuntu ubuntu 4096 Mar 13 20:07 admin
drwxrwxrwx 4 ubuntu ubuntu 4096 Mar 13 20:07 global

#

i think these are all permissions

cedar bear
#

ls -lh /home/?

clear lichen
#

ah this was the command

#

to see the permissions

cedar bear
#

Just need to see permissions on the /home/ dir ๐Ÿ™‚

clear lichen
#

ah

#

ls -lh /home/
total 4.0K
drwxr-x--- 9 ubuntu ubuntu 4.0K Mar 15 17:52 ubuntu

cedar bear
#

Well, the Ubuntu users dir, but it'll show easier in home

#

There's your problem. Nginx can't access /home/ubuntu/ at all.
Move your images to a new directory like /srv/http/media/, update your nginx and Django config, and you should be golden.

clear lichen
#

hm

#

wait i dont get it

#

i cant give access to /home/ubuntu then?

cedar bear
#

You shouldn't

#

You can, of course, but that's bad practice, IMO.

clear lichen
#

but if i change to another diretory, my images will load from the wrong place right?

cedar bear
#

Hence why you need to update the nginx and Django config.

clear lichen
#

tbh i just made a small game for some friends

cedar bear
#

You could add the nginx user to the Ubuntu group.

#

Since your permissions are 750

clear lichen
#

how i do that?

short drum
#

great! so you're not pressed on time, all the more reason to do it right!

clear lichen
#

like which command

clear lichen
#

but the problem is that i had this problem

#

the entire week

#

i am so tired : (

cedar bear
#

Should be quick to move though... Just need to edit two files and restart services ๐Ÿ˜‰

clear lichen
#

alright

#

how i do that

#

i have to sudo nano

#

idk

#

collectstatic?

cedar bear
#

Change MEDIA_ROOT in settings, and alias in nginx.conf.

clear lichen
#

wait

#

STATIC_URL = 'static/'
STATICFILES_DIRS = (
BASE_DIR / 'base_static',
)
STATIC_ROOT = BASE_DIR / 'static' #collectstatic

MEDIA_URL = 'media/'
MEDIA_ROOT = BASE_DIR / 'media'

#that is inside my settings.py

#

server {
listen 80;
listen [::]:80;
server_name 35.180.100.66;

Add index.php to the list if you are using PHP

index index.html index.htm index.nginx-debian.html index.php;

ATTENTION: /home/ubuntu/jogo/project/static

location /static {
autoindex on;
alias /home/ubuntu/jogo/project/static;
}

ATTENTION: /home/ubuntu/jogo/project/media

location /media {
autoindex on;
alias /home/ubuntu/jogo/project/media;
}

this is in my nginx server

cedar bear
#
sudo mkdir -p /srv/http/{media,static}
sudo chown -R ubuntu:ubuntu /srv/http
clear lichen
#

alright

#

i used them

cedar bear
#

In settings.py

STATIC_ROOT = "/srv/http/static/"
MEDIA_ROOT = "/srv/http/media/"
clear lichen
#

are you sure?

#

well lets see

cedar bear
#

In nginx.conf:

  location /static {
    autoindex on;
    root /srv/http/;
  }

  # ATTENTION: /home/ubuntu/jogo/project/media 
  location /media {
    autoindex on;
    root /srv/http/;
  }
#

After that, restart your wsgi server (gunicorn?) and nginx, run collectstatic, and if you have media files, move them from /home/ubuntu/jogo/project/media/ to /srv/http/media/...

#

And you should be good, and I should be cooking ๐Ÿ˜…

clear lichen
#

thanks i will try that

#

now it says not found

#

: (

#

but i think we are in the right way

#

ah

#

i didnt use collecstatic

#

IT WORKED

#

THANK YOU

#

@cedar bear i love you

clear lichen
#

damn

#

for some reason my game is totally bugged here in ubuntu

#

: (

#

when i play in my localhost everything goes right

#

@cedar bear please help me again when you able : (

short drum
#

Since this problem is resolved, it's better if you give more detail about your new issues.

#

It's not possible for Pat (or anyone for that matter) to guess what works right locally and what bugs via your deployment configuration.

clear lichen
#

well my game is working correctly when i play it outside ubuntu
but not it has a lot of bugs

i am trying to find a way to explain properly

#

without images is hard : (

#

but let me try

short drum
#

Check your browser's console for errors.

clear lichen
#

you mean inspect element?

short drum
#

your browser's "Dev Tools", if your game is using javascript of any kind, or any image is unaccessible, or you're getting any network errors, your devtools should give you this information.

clear lichen
#

which i think isnt a problem now

#

in my django application

short drum
#

all network resources are loaded correctly?

clear lichen
#

i have this list
feiticos = []
in my model

short drum
#

well then now you can explain your problem, but try to formulate the question such that you know whether it's related to deployment or anything else.

#

It makes it easier for those that are willing to help to read your problem in one go, rather than having to go through multiple messages.

clear lichen
#

how can i past my code

short drum
#

#readme-1st

clear lichen
#

thanks

#
def batalha2(request):
    player = get_object_or_404(Player, name='Yuji')
    resto_turno = player.turno % 2    
    player.venceu_fase2 == False
    player.save()
    if 'tutorial' in request.GET:
        context = {
        'tutorial': True,
        'energy': player.energy_point,
        'life': player.life_round2,
        'elife': player.enemy_life_round2,
        'feiticos_img': player.imagens_feiticos,
        'dark_energy_blast' : player.dark_energy_blast,
        'dark_energy_shield': player.dark_energy_shield,
        'turno': player.turno,
        'resto_turno': resto_turno,
        'dark_energy': player.dark_energy,
        'rising_energy' : player.rising_energy,
        'acceleration': player.acceleration,
        'angelwing': player.angel_wing,
        'calculo_player': int(player.calculo_dano_player),
        'calculo_inimigo': int(player.calculo_dano_inimigo),
        'contagem': player.contagem,
        'expandir': player.limite,
        'thousandknives': player.thounsand_knives,
        'millenniumshield': player.millennium_shield,
        
        }
        return render(
            request, 
            'contact/batalha2.html',
            context,
        )
    
    
    player.fase_atual = 2
    player.save()
#
        player.energy_point = player.energy_pointFase1
        player.life_round2 = player.life_round2savepoint
        player.enemy_life_round2 = 4000
        player.rising_energy = False
        player.thounsand_knives = False
        player.millennium_shield = False
        player.angel_wing = False
        player.acceleration = False
        player.calculo_dano_player = 0
        player.calculo_dano_inimigo = 0
        player.dark_energy = 200
        player.dark_energy_shield = False
        player.dark_energy_blast = False
        player.dark_aura = False
        player.defesa_acumulada_inimigo = 0
        player.defesa_acumulada = 0
        player.turno= 0
        player.contagem = 0
        player.stand_by = False
        player.feiticos = []
        player.imagens_feiticos = []
        player.limite==3
        player.save()

        
    # if request.method == 'POST':
    if player.contagem == 0:
        if player.turno % 2 == 0:
            player.dark_energy_shield=True
            player.save()
        else:
            player.dark_energy_blast = True
            player.save()
#
if 'faseDeBatalha' in request.GET:
        
        if player.turno % 2 == 0:
        
            player.turno += 1
            player.dark_energy_shield=False
            poder = random.choice([10,11,12,13,14,15,16,17,18,19,20])
            player.dark_energy -= poder
            player.calculo_dano_inimigo += poder * 80 
            player.save()
        else:
            player.turno += 1
            player.dark_energy_blast = False
            poder = random.choice([10,11,12,13,14,15,16,17,18,19,20])
            player.dark_energy -= poder
            player.calculo_dano_player -= poder * 80
            player.save()   
            
        for n in player.feiticos:
            if n == 1:
                player.energy_point -= 5
                player.life_round2 += 300
                player.save()
            if n == 2:
                player.energy_point -= 5
                player.calculo_dano_inimigo -= 500
                player.save()
            if n == 3:    
                player.energy_point -= 12
                player.calculo_dano_player = 0
                player.save()
            if n == 5:
                player.energy_point -= 7
                player.calculo_dano_player += 500
                player.save()
            if n == 7:
                player.energy_point -= 10
                player.enemy_life_round2 -= 1200
                player.save()
            if n == 9:
                player.energy_point -= 8
                player.calculo_dano_player += 1000
                player.save()
            if n == 10:
                player.energy_point -= 3
                player.calculo_dano_inimigo -= 300
                player.save()
       
    
#
            player.energy_point -= 15
            player.calculo_dano_inimigo *= 150/100
            player.calculo_dano_player = (player.calculo_dano_player * 10)/100
            player.save()
        
        if 8 in player.feiticos:
            player.energy_point -= 10
            player.calculo_dano_player += 700
            player.save()
            
        if player.turno % 2 == 0:
            if player.calculo_dano_inimigo == 0:
                player.dark_energy += poder
            player.save()
        

        
        if player.calculo_dano_player < 0:
            player.life_round2 += player.calculo_dano_player
            player.calculo_dano_player = 0
            # player.contagem += 1
            player.save()
        if player.calculo_dano_inimigo < 0:
            player.enemy_life_round2 += player.calculo_dano_inimigo
            player.calculo_dano_inimigo = 0
            # player.contagem += 1
            player.save()
        player.contagem = 0
        if player.limite != 3:
            player.limite = 3
            player.save()
        if 8 in player.feiticos:
                player.limite += 1                
                player.save()
        if 4 in player.feiticos:
            player.energy_point -= 10
            player.limite += 2
            player.save()
        if player.contagem == 0:
            player.feiticos.clear()
            player.imagens_feiticos.clear()
            player.save()
        player.save()
#
        player.feiticos.append(1)
        player.imagens_feiticos.append('blue_medicine.jpg')
        player.contagem += 1
        player.save()
    if 'hinotama' in request.GET and player.contagem < player.limite :
        player.feiticos.append(2)
        player.imagens_feiticos.append('hinotama.jpg')
        player.contagem += 1
        player.save()

    if 'evasion' in request.GET and player.contagem < player.limite:
        player.contagem += 1
        player.feiticos.append(3)
        player.imagens_feiticos.append('evasion.jpg')

        player.save()

    if 'acceleration' in request.GET and player.contagem < player.limite:
        player.contagem += 1
        player.feiticos.append(4)
        player.imagens_feiticos.append('acceleration.png')
        player.acceleration = True
        player.save()
    
    if 'ringofdefense' in request.GET and player.contagem < player.limite:
        player.contagem += 1
        player.feiticos.append(5)
        player.imagens_feiticos.append('ringofdefense.jpg')
        player.save()
          
    if 'risingenergy' in request.GET and player.contagem < player.limite:
        player.contagem += 1
        player.feiticos.append(6)
        player.imagens_feiticos.append('RisingEnergy.webp')
        player.rising_energy = True
        player.save()

           
    if 'thousandknives' in request.GET and player.contagem < player.limite:
            player.contagem += 1
            player.thounsand_knives = True
            player.feiticos.append(7)
            player.imagens_feiticos.append('thousandknives.png')
            player.save()
           
    if 'angelwing' in request.GET and player.contagem < player.limite:
        player.contagem += 1
        player.feiticos.append(8)
        player.imagens_feiticos.append('angelwing.jpg')
        player.angel_wing = True
        player.save()
        
   

        
    
    ```
#

if 'millenniumshield' in request.GET and player.contagem < player.limite:
        player.contagem += 1
        player.feiticos.append(9)
        player.millennium_shield = True
        player.imagens_feiticos.append('millenniumshield.jpg')
        player.save()
        
    if 'gun' in request.GET  and player.contagem < player.limite:
        player.contagem += 1
        player.imagens_feiticos.append('gun.jpg')
        player.feiticos.append(10)
        player.save()
    if 'nothing' in request.GET  and player.contagem < player.limite:
        player.contagem = 3
        player.save()
    
    resto_turno = player.turno % 2    
    
    if player.enemy_life_round2 <= 0 or player.dark_energy <= 0:
        player.venceu_fase2 == True
        player.save()
        return redirect('contact:history3')

    if player.life_round2 <= 0 or player.energy_point <=0:
        return redirect('contact:resultado')

    
    context = {
        'energy': player.energy_point,
        'life': player.life_round2,
        'elife': player.enemy_life_round2,
        'feiticos_img': player.imagens_feiticos,
        'dark_energy_blast' : player.dark_energy_blast,
        'dark_energy_shield': player.dark_energy_shield,
        'turno': player.turno,
        'resto_turno': resto_turno,
        'dark_energy': player.dark_energy,
        'rising_energy' : player.rising_energy,
        'acceleration': player.acceleration,
        'angelwing': player.angel_wing,
        'calculo_player': int(player.calculo_dano_player),
        'calculo_inimigo': int(player.calculo_dano_inimigo),
        'contagem': player.contagem,
        'expandir': player.limite,
        'thousandknives': player.thounsand_knives,
        'millenniumshield': player.millennium_shield,
        
    }
    return render(
        request, 
        'contact/batalha2.html',
        context,
    )

#

this is my "batalha2" view

#

and in my model i have this list : feiticos = []

#

and this list get some numbers in appends depending what option the user clicked

#

in my localhost when i run it in my vs code it appends and removes properly

#

but in ubuntu it got crazy and keep adding some numbers without clicking anything

#

i am looking at my admin page right now and it says 2,2,2,5
now i reloaded and it says 2,2,5,2

but it should only add numbers when i click in certain images

#

just like in my localhost

#

if 'acceleration' in request.GET and player.contagem < player.limite:
player.contagem += 1
player.feiticos.append(4)
player.imagens_feiticos.append('acceleration.png')
player.acceleration = True
player.save()

like this

#

acceleration only goes to request.GET if i click in a certain image

short drum
#

My friend, I think you're on the right path to solving this problem. Walk yourself through what you wrote and figure out where it's not working. There's far too much code and far too much context for us to give you any helpful advice.

clear lichen
#

but it doesnt make sense

#

in my 127.0.0.1 it always worked perfectly

short drum
#

The one thing I see real quick is this player.venceu_fase2 == False it does nothing.

clear lichen
#

and still does

clear lichen
#

๐Ÿ˜…

#

if you want i can stream my computer etc.

#

๐Ÿ˜ญ

short drum
#
  • if things are changing without your interactions check your browser's devtools network log and see what are the outgoing requests
  • if there are no additional requests being done, check your views and see whether you have any ongoing loops that are not ending
  • if there's are bugs caused by logic between your localhost/remote deployments, I'd drop the database on my localhost and start a fresh one as if i'm running a new remote deployment. Chances are your localhost db is configured in a "happy path" way.
clear lichen
#

๐Ÿง

#

outgoing requests hmm

clear lichen
#

with outgoing requests?

short drum
#

yes outgoing requests

clear lichen
#

there is nothing here

#

just that https thing

#

this is my game if you want to test lol

#

it is in portuguese lol

#

but the web translates it right

#

so no problem

#

hm i already have another instance with my game

#

but with the image bug etc.

#

let me see if that work properly

#

not working too

short drum
#

you really do need to cleanup your urls, views and templates; it's the first step to identifying your problem.

Right now it's quite messy and I honestly cannot tell what's what and what your problem really is.

clear lichen
#

but lets think about it

#

if it works perfectly in my localhost

#

what can go wrong?

#

what can even happen

short drum
#

There's an infinite number of things that can go wrong, so instead of trying to find the needle in the haystack; please, describe what you have, what actions you're taking, what behavior you're witnessing versus what behavior you're expecting to see.

clear lichen
clear lichen
#

i just a student i dont know about many things but if my code was perfect before and the code didnt change this means that the code isnt the problem right?

#

it is something related to ubuntu, right?

short drum
#

not necessarily.

the way you are defining things like feiticos = [] are not persisted in the database.

Did you know this?

#

the difference between your local runtime and your ubuntu runtime is that gunicorn will use multiple worker processes.

clear lichen
#

how should i create

#

monstros_fase3 = []

fase_atual = models.IntegerField(default=1)

resultado = models.CharField(max_length=255, default="l")

historiaVariavel = models.IntegerField(default=1)
historiaVariavel2 = models.IntegerField(default=1)
historiaVariavel3 = models.IntegerField(default=1)

batalha_em_andamento = models.BooleanField(default=False)

venceu_fase2 = models.BooleanField(default=False)

lista_boss = [ 
    {'id': 1, 'img':'global/img/armedragon.webp', 'atk': 2800},
    {'id': 2, 'img':'global/img/cosmoqueen.webp', 'atk': 2900},
    {'id': 3, 'img':'global/img/metalarmoredbug.webp', 'atk': 2800},          
    {'id': 4, 'img':'global/img/tri-horned-dragon.webp', 'atk': 2850},
    {'id': 5, 'img':'global/img/wingweaver.webp', 'atk': 2750},
    
]
boss_escolhido = models.CharField(max_length=255, default='')
boss_escolhido_atk = models.IntegerField(default=0)


lista_imagem = [
    {'id': 1, 'img':'global/img/red-eyes-black-dragon-en002.webp', 'atk': 2400},
    {'id': 2, 'img':'global/img/swordstalker.jpg', 'atk': 2000},
    {'id': 3, 'img':'global/img/flamecerebrus.jpg', 'atk': 2100},
    {'id': 4, 'img':'global/img/anotherversedragon.jpg', 'atk': 2500},
    {'id': 5, 'img':'global/img/warwolf.jpg', 'atk': 2000},
    {'id': 6, 'img':'global/img/boarder.jpg', 'atk': 2000},
    {'id': 7, 'img':'global/img/vorseraider.webp', 'atk': 1900}, 
]
#

these lists in my model?

#

like there was an option to charfield, integer etc.

#

but what is the option for lists

short drum
#

what database server are you using ?

clear lichen
#

postgree

clear lichen
#

arrayfield

#

i see

#

do you think this was the problem?

#

because in my local application it always restarted

short drum
#

yes, and runserver behaves differently

clear lichen
#

alright

#

monday i will work on it

short drum
#

good luck

clear lichen
#

๐Ÿ˜ญ

#

@short drum wait

#

i cant find the "array field" here

#

ah sorry

#

nvm

#

i have to import it

clear lichen
#

hi

#

i need help again

#

feiticos = ArrayField(models.IntegerField())

these fields are correct but i couldnt make it for all fields

#

batalha3lista = ArrayField(
base_field=JSONField(),
default =list(
{'i':'1', 'v':'', 't': 0, 'atk': 0}, {'i':'2', 'v':'', 't': 0, 'atk': 0}, {'i':'3', 'v':'', 't': 0, 'atk': 0}, {'i':'4', 'v':'', 't': 0, 'atk': 0},{'i':'5', 'v':'', 't': 0, 'atk': 0}],
[{'i':'6', 'v':'', 't': 0, 'atk': 0}, {'i':'7', 'v':'', 't': 0, 'atk': 0}, {'i':'8', 'v':'', 't': 0, 'atk': 0}, {'i':'9', 'v':'', 't': 0, 'atk': 0},{'i':'10', 'v':'', 't': 0, 'atk': 0}],
[{'i':'11', 'v':'', 't': 0, 'atk': 0}, {'i':'12', 'v':'', 't': 0, 'atk': 0}, {'i':'13', 'v':'', 't': 0, 'atk': 0}, {'i':'14', 'v':'', 't': 0, 'atk': 0},{'i':'15', 'v':'', 't': 0, 'atk': 0}],
[{'i':'16', 'v':'', 't': 0, 'atk': 0}, {'i':'17', 'v':'', 't': 0, 'atk': 0}, {'i':'18', 'v':'', 't': 0, 'atk': 0}, {'i':'19', 'v':'', 't': 0, 'atk': 0},{'i':'20', 'v':'', 't': 0, 'atk': 0}]
))

#

like this one

#

contact.Player.lista_imagem: (postgres.E001) Base field for array has errors:
django.contrib.postgres.fields.JSONField is removed except for support in historical migrations. (fields.E904)

this is the error for all these ArrayFields that have stuff inside

#

@short drum @cedar bear can you guys take a look on this?

#

i didnt find how to do this in that documentation

#

that documentation helped me with fields like this only:

feiticos = ArrayField(models.IntegerField())

cedar bear
#

I imagine you have to use the built-in JSONField, not the one provided by django.contrib.postgres.fields, but I don't know for sure...

clear lichen
#

hm

#

if i dont import it from postgres fields, the vs code dont find any JSONField

cedar bear
#
from django.db import models
...
base_field=models.JSONField()
```?
clear lichen
#

from django.contrib.postgres.fields import ArrayField, JSONField

#

from django.db import models

#

these are the modules i am importing

#

ah

#

i see

#

alright

#

WARNINGS:
contact.Player.batalha3lista: (fields.E010) ArrayField default should be a callable instead of an instance so that it's not shared between all field instances.
HINT: Use a callable instead, e.g., use list instead of [].
contact.Player.cardlist: (fields.E010) ArrayField default should be a callable instead of an instance so that it's not shared between all field instances.
HINT: Use a callable instead, e.g., use list instead of [].
contact.Player.lista_boss: (fields.E010) ArrayField default should be a callable instead of an instance so that it's not shared between all field instances.
HINT: Use a callable instead, e.g., use list instead of [].
contact.Player.lista_imagem: (fields.E010) ArrayField default should be a callable instead of an instance so that it's not shared between all field instances.
HINT: Use a callable instead, e.g., use list instead of [].

System check identified 4 issues (0 silenced).
March 18, 2024 - 17:31:11
Django version 4.2.7, using settings 'project.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

#

also this warning, basically i cant use [ ] right

#

so i have to make empty lists

#

yeah

#

actually i don't know because i removed all []

#

but i keep getting this warning

cedar bear
#

You probably need default=list rather than your list instance.

clear lichen
#

yep

#

thanks

clear lichen
#

hi

#

sorry to bother again

#

right now i tested my application in my localhost with postgree and i fixed all problems

#

then i changed my files in ubuntu with sudo nano

#

makemigrations and migrate

#

but now when i create my "player" in database in ubuntu i get this:
a white screen with "Server Error (500)"

#

nothing else in browser log

cedar bear
#

django version?

#

Did you enable the CSRF sources in settings?

clear lichen
#

what you mean

#

i mean the application was running before

#

like it was running but it was bugged

#

now it isnt running anymore

#

after i changed the code

cedar bear
#

Actually, never mind, CSRF would give a 403. Enable debug and try again

clear lichen
#

enable debug ok

#

nothing changed after i changed debug to True

#

if form.is_valid():
Player.objects.all().delete()

        player1 = form.save(commit=False)
        player1.save()

        player = get_object_or_404(Player, name='Yuji')
        player.lista_boss.append({'id': 1, 'img':'global/img/armedragon.webp', 'atk': 2800})
        player.lista_boss.append({'id': 2, 'img':'global/img/cosmoqueen.webp', 'atk': 2900})
        player.lista_boss.append({'id': 3, 'img':'global/img/metalarmoredbug.webp', 'atk': 2800})
        player.lista_boss.append({'id': 4, 'img':'global/img/tri-horned-dragon.webp', 'atk': 2850})
        player.lista_boss.append({'id': 5, 'img':'global/img/wingweaver.webp', 'atk': 2750})

MORE APPENDS
...

player.save()
return redirect('contact:history')

#

this is the view that isnt working

#

in my django ubuntu

#

but works in my localhost with postgree

cedar bear
#

Sorry, but you'll need to find a way to log the error

clear lichen
#

hm

#

any suggestion?

cedar bear
#

Enable logging

clear lichen
#

15.188.52.54/:1

   POST http://15.188.52.54/ 500 (Internal Server Error)
#

it just says that in console

#

after i put debug=true

cedar bear
#

Is that nginx or django logs?

clear lichen
#

that log is from browser

cedar bear
#

Huh?

clear lichen
#

ubuntu@ip-172-31-40-118:~/django_agenda$ sudo tail -f /var/log/nginx/error.log
2024/03/19 18:28:26 [alert] 42958#42958: *32 open socket #3 left in connection 5
2024/03/19 18:28:26 [alert] 42958#42958: aborting

cedar bear
#

How are you running django?

clear lichen
cedar bear
#

You also need a wsgi server

clear lichen
#

i dont remeber the name let me check

#

gunicorn

#

2024-03-13 00:15:42 +0000] [21351] [DEBUG] Current configuration:
config: ./gunicorn.conf.py
wsgi_app: None
bind: ['unix:/run/agenda.socket']
backlog: 2048
workers: 6
worker_class: sync
threads: 1
worker_connections: 1000
max_requests: 0
max_requests_jitter: 0
timeout: 30
graceful_timeout: 30
keepalive: 2
limit_request_line: 4094
limit_request_fields: 100
limit_request_field_size: 8190
reload: False
reload_engine: auto
reload_extra_files: []

#

but look my application was working before i made changes on django_agenda code

clear lichen
#

ah wait

#

this is old

#

sorry

#

i have the logs, searching for current ones

#

o>24-03-19 00:03:02 -0300] [561] [DEBUG] GET /manager/html

    • [19/Mar/2024:00:03:02 -0300] "GET /manager/html HTTP/1.1" 404 179 "-" "Mozilla/5.0 zgrab/0.x"
      [2024-03-19 00:23:10 -0300] [564] [DEBUG] GET /
    • [19/Mar/2024:00:23:10 -0300] "GET / HTTP/1.1" 200 1657 "-" "-"
      [2024-03-19 00:42:34 -0300] [559] [DEBUG] GET /
    • [19/Mar/2024:00:42:34 -0300] "GET / HTTP/1.1" 200 1657 "-" "Expanse, a Palo Alto Networks company, searches across the global IPv4 space>24-03-19 00:51:36 -0300] [565] [DEBUG] GET /
    • [19/Mar/2024:00:51:36 -0300] "GET / HTTP/1.1" 200 1657 "-" "-"
      [2024-03-19 01:09:48 -0300] [564] [DEBUG] POST /
    • [19/Mar/2024:01:09:48 -0300] "POST / HTTP/1.1" 403 1436 "-" "python-requests/2.31.0"
      [2024-03-19 01:09:48 -0300] [561] [DEBUG] GET /
    • [19/Mar/2024:01:09:48 -0300] "GET /?%3Cplay%3Ewithme%3C/%3E HTTP/1.1" 200 1657 "-" "python-requests/2.31.0"
      [2024-03-19 01:09:48 -0300] [562] [DEBUG] POST /
    • [19/Mar/2024:01:09:48 -0300] "POST / HTTP/1.1" 403 1436 "-" "python-requests/2.31.0"
      [2024-03-19 01:09:48 -0300] [566] [DEBUG] POST /
    • [19/Mar/2024:01:09:48 -0300] "POST / HTTP/1.1" 403 1436 "-" "python-requests/2.31.0"
      [2024-03-19 01:29:26 -0300] [565] [DEBUG] POST /
    • [19/Mar/2024:01:29:26 -0300] "POST / HTTP/1.1" 403 1436 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ch[2024-03-19 02:51:13 -0300] [559] [DEBUG] POST /
    • [19/Mar/2024:02:51:13 -0300] "POST / HTTP/1.1" 403 1436 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ch[2024-03-19 02:52:48 -0300] [566] [DEBUG] GET /
#
    • [19/Mar/2024:02:52:48 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like G[2024-03-19 02:52:49 -0300] [565] [DEBUG] GET /
    • [19/Mar/2024:02:52:49 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like G[2024-03-19 04:37:10 -0300] [565] [DEBUG] GET /
    • [19/Mar/2024:04:37:10 -0300] "GET / HTTP/1.1" 200 1657 "-" "Expanse, a Palo Alto Networks company, searches across the global IPv4 spa[2024-03-19 04:45:17 -0300] [562] [DEBUG] GET /
    • [19/Mar/2024:04:45:17 -0300] "GET / HTTP/1.1" 200 1657 "-" "Expanse, a Palo Alto Networks company, searches across the global IPv4 space>
#
    • [19/Mar/2024:06:08:39 -0300] "POST / HTTP/1.1" 403 1436 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ch[2024-03-19 06:22:33 -0300] [565] [DEBUG] GET /
    • [19/Mar/2024:06:30:55 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like [2024-03-19 07:06:19 -0300] [566] [DEBUG] POST /
    • [19/Mar/2024:07:06:19 -0300] "POST / HTTP/1.1" 403 1436 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ch[2024-03-19 08:28:16 -0300] [561] [DEBUG] GET /
    • [19/Mar/2024:08:28:16 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML,[2024-03-19 08:28:20 -0300] [562] [DEBUG] GET /
    • [19/Mar/2024:08:28:20 -0300] "GET / HTTP/1.1" 400 143 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, [2024-03-19 08:28:26 -0300] [564] [DEBUG] GET /favicon.ico
    • [19/Mar/2024:08:28:26 -0300] "GET /favicon.ico HTTP/1.1" 404 179 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.[2024-03-19 09:32:53 -0300] [561] [DEBUG] POST /
    • [19/Mar/2024:09:32:53 -0300] "POST / HTTP/1.1" 403 1436 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ch[2024-03-19 09:43:27 -0300] [559] [DEBUG] POST /
    • [19/Mar/2024:09:43:27 -0300] "POST / HTTP/1.1" 403 1436 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ch[2024-03-19 10:32:35 -0300] [564] [DEBUG] GET /
    • [19/Mar/2024:10:32:35 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Ge>
#
    • [19/Mar/2024:11:29:38 -0300] "POST / HTTP/1.1" 403 1436 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ch[2024-03-19 11:33:45 -0300] [565] [DEBUG] POST /
    • [19/Mar/2024:11:33:45 -0300] "POST / HTTP/1.1" 403 1436 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ch[2024-03-19 13:14:42 -0300] [566] [DEBUG] GET /Dockerrun.aws.json
    • [19/Mar/2024:13:14:42 -0300] "GET /Dockerrun.aws.json HTTP/1.1" 404 179 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 15_3 like Mac OS X) Ap[2024-03-19 13:27:49 -0300] [564] [DEBUG] GET /favicon.ico
    • [19/Mar/2024:13:29:39 -0300] "HEAD /Core/Skin/Login.aspx HTTP/1.1" 404 179 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/[2024-03-19 13:29:39 -0300] [562] [DEBUG] Ignoring EPIPE
      [2024-03-19 13:44:39 -0300] [565] [DEBUG] GET /cdn-cgi/trace
    • [19/Mar/2024:13:44:39 -0300] "GET /cdn-cgi/trace HTTP/1.1" 400 143 "-" "Mozilla/5.0"
      [2024-03-19 13:48:37 -0300] [564] [DEBUG] POST /
    • [19/Mar/2024:13:48:37 -0300] "POST / HTTP/1.1" 403 1436 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ch[2024-03-19 14:12:57 -0300] [564] [DEBUG] GET /
    • [19/Mar/2024:14:12:57 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome[2024-03-19 14:25:55 -0300] [566] [DEBUG] GET /portal/redlion
    • [19/Mar/2024:14:25:55 -0300] "GET /portal/redlion HTTP/1.1" 404 179 "-" "Mozilla/5.0 zgrab/0.x"
      [2024-03-19 14:30:19 -0300] [562] [DEBUG] POST /
#
  • [19/Mar/2024:14:30:19 -0300] "POST / HTTP/1.1" 403 1436 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ch[2024-03-19 15:01:16 -0300] [564] [DEBUG] HEAD /Core/Skin/Login.aspx
    • [19/Mar/2024:15:01:16 -0300] "HEAD /Core/Skin/Login.aspx HTTP/1.1" 404 179 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/[2024-03-19 15:01:16 -0300] [564] [DEBUG] Ignoring EPIPE
      [2024-03-19 15:10:44 -0300] [561] [DEBUG] GET /
    • [19/Mar/2024:15:10:44 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like [2024-03-19 15:10:45 -0300] [566] [DEBUG] GET /admin/contact/player/
    • [19/Mar/2024:15:10:45 -0300] "GET /admin/contact/player/ HTTP/1.1" 200 16217 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKi[2024-03-19 15:10:46 -0300] [565] [DEBUG] GET /admin/jsi18n/
    • [19/Mar/2024:15:10:55 -0300] "POST / HTTP/1.1" 500 145 "http://15.188.52.54/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/5[2024-03-19 15:11:25 -0300] [562] [DEBUG] GET /admin/contact/player/
    • [19/Mar/2024:15:11:25 -0300] "GET /admin/contact/player/ HTTP/1.1" 200 7572 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit[2024-03-19 15:11:26 -0300] [565] [DEBUG] GET /admin/jsi18n/
#
    • [19/Mar/2024:15:11:29 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like [2024-03-19 15:11:34 -0300] [566] [DEBUG] POST /
    • [19/Mar/2024:15:11:34 -0300] "POST / HTTP/1.1" 500 145 "http://15.188.52.54/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/5[2024-03-19 15:12:43 -0300] [565] [DEBUG] GET /
    • [19/Mar/2024:15:12:43 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like [2024-03-19 15:12:47 -0300] [559] [DEBUG] POST /
    • [19/Mar/2024:15:12:47 -0300] "POST / HTTP/1.1" 500 145 "http://15.188.52.54/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/5[2024-03-19 15:13:39 -0300] [564] [DEBUG] GET /
    • [19/Mar/2024:15:13:39 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like [2024-03-19 15:13:43 -0300] [566] [DEBUG] POST /
    • [19/Mar/2024:15:13:43 -0300] "POST / HTTP/1.1" 500 145 "http://15.188.52.54/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/5[2024-03-19 15:14:39 -0300] [559] [DEBUG] GET /
    • [19/Mar/2024:15:14:39 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like [2024-03-19 15:14:42 -0300] [564] [DEBUG] POST /
    • [19/Mar/2024:15:14:42 -0300] "POST / HTTP/1.1" 500 145 "http://15.188.52.54/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/5[2024-03-19 15:15:00 -0300] [559] [DEBUG] GET /
    • [19/Mar/2024:15:15:00 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like [2024-03-19 15:15:03 -0300] [566] [DEBUG] POST /
#
    • [19/Mar/2024:15:15:03 -0300] "POST / HTTP/1.1" 500 145 "http://15.188.52.54/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/5[2024-03-19 15:15:05 -0300] [559] [DEBUG] GET /admin/contact/player/
    • [19/Mar/2024:15:15:05 -0300] "GET /admin/contact/player/ HTTP/1.1" 200 7572 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit[2024-03-19 15:15:06 -0300] [566] [DEBUG] GET /admin/jsi18n/
    • [19/Mar/2024:15:16:29 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like [2024-03-19 15:16:31 -0300] [562] [DEBUG] POST /
    • [19/Mar/2024:15:16:31 -0300] "POST / HTTP/1.1" 500 145 "http://15.188.52.54/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/5[2024-03-19 15:16:35 -0300] [561] [DEBUG] GET /history/
    • [19/Mar/2024:15:16:35 -0300] "GET /history/ HTTP/1.1" 404 179 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML[2024-03-19 15:16:43 -0300] [562] [DEBUG] GET /history2/
    • [19/Mar/2024:15:16:43 -0300] "GET /history2/ HTTP/1.1" 404 179 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTM[2024-03-19 15:16:46 -0300] [564] [DEBUG] GET /
    • [19/Mar/2024:15:16:46 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like [2024-03-19 15:16:49 -0300] [559] [DEBUG] GET /
    • [19/Mar/2024:15:16:49 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like [2024-03-19 15:19:27 -0300] [561] [DEBUG] POST /
    • [19/Mar/2024:15:19:27 -0300] "POST / HTTP/1.1" 500 145 "http://15.188.52.54/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/5
#
    • [19/Mar/2024:15:22:17 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like [2024-03-19 15:22:20 -0300] [564] [DEBUG] POST /
    • [19/Mar/2024:15:22:20 -0300] "POST / HTTP/1.1" 500 145 "http://15.188.52.54/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/5[2024-03-19 15:27:53 -0300] [564] [DEBUG] GET /
    • [19/Mar/2024:15:27:53 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like [2024-03-19 15:27:57 -0300] [559] [DEBUG] POST /
    • [19/Mar/2024:15:27:57 -0300] "POST / HTTP/1.1" 500 145 "http://15.188.52.54/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/5[2024-03-19 15:27:59 -0300] [564] [DEBUG] GET /admin/contact/player/
    • [19/Mar/2024:15:27:59 -0300] "GET /admin/contact/player/ HTTP/1.1" 200 7572 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit[2024-03-19 15:28:00 -0300] [565] [DEBUG] GET /admin/jsi18n/
    • [19/Mar/2024:15:28:28 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like [2024-03-19 15:28:31 -0300] [562] [DEBUG] GET /
    • [19/Mar/2024:15:28:31 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like [2024-03-19 15:28:33 -0300] [564] [DEBUG] POST /
    • [19/Mar/2024:15:28:33 -0300] "POST / HTTP/1.1" 500 145 "http://15.188.52.54/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/5[2024-03-19 15:35:38 -0300] [564] [DEBUG] GET /admin/contact/player/
    • [19/Mar/2024:15:35:38 -0300] "GET /admin/contact/player/ HTTP/1.1" 200 7572 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit
#
#

2024-03-19 15:35:52 -0300] [561] [DEBUG] GET /admin/jsi18n/

    • [19/Mar/2024:15:35:54 -0300] "GET /admin/auth/user/1/change/?_changelist_filters=o%3D2.1 HTTP/1.1" 200 20746 "http://15.188.52.54/admi[2024-03-19 15:35:54 -0300] [561] [DEBUG] GET /admin/jsi18n/
    • [19/Mar/2024:15:36:04 -0300] "POST /admin/auth/user/1/change/?_changelist_filters=o%3D2.1 HTTP/1.1" 302 0 "http://15.188.52.54/admin/a[2024-03-19 15:36:04 -0300] [566] [DEBUG] GET /admin/auth/user/
    • [19/Mar/2024:15:36:43 -0300] "POST / HTTP/1.1" 500 145 "http://15.188.52.54/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/5[2024-03-19 15:37:24 -0300] [565] [DEBUG] GET /
    • [19/Mar/2024:15:37:24 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like [2024-03-19 15:37:26 -0300] [566] [DEBUG] GET /favicon.ico
    • [19/Mar/2024:15:37:26 -0300] "GET /favicon.ico HTTP/1.1" 404 179 "http://15.188.52.54/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) App
#

[2024-03-19 15:41:30 -0300] [565] [DEBUG] POST /

    • [19/Mar/2024:15:41:30 -0300] "POST / HTTP/1.1" 500 145 "http://15.188.52.54/" "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) [2024-03-19 15:41:50 -0300] [561] [DEBUG] POST /
    • [19/Mar/2024:15:41:50 -0300] "POST / HTTP/1.1" 500 145 "http://15.188.52.54/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/5[2024-03-19 15:42:08 -0300] [566] [DEBUG] GET /
    • [19/Mar/2024:15:42:08 -0300] "GET / HTTP/1.1" 200 1657 "-" "python-requests/2.27.1"
      [2024-03-19 15:42:08 -0300] [564] [DEBUG] GET /
    • [19/Mar/2024:15:42:08 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com)"
      [2024-03-19 15:42:41 -0300] [565] [DEBUG] GET /
    • [19/Mar/2024:15:42:41 -0300] "GET / HTTP/1.1" 200 1657 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Ge>
#

i think this is all from today

#

maybe this isnt even the correct logs?

#

omg

#

its a file called gunicorn error log

#

wait it worked now

#

i dont even know

#

i just restarted

#

all

#

now its working perfectly

#

sorry for this lol

#

i dont even know what happened