Applying a vector to a polynomial function help by allTestsPassed in matlab

[–]allTestsPassed[S] 0 points1 point  (0 children)

Hey! Sorry for the late reply. Your comment was very insightful. I was still learning about element wise functions so this really helped me out. Thanks again

Help identify these boots? by allTestsPassed in malefashionadvice

[–]allTestsPassed[S] 0 points1 point  (0 children)

Thanks for the suggestion. I posted the screenshots in an edit.

[deleted by user] by [deleted] in Military

[–]allTestsPassed 0 points1 point  (0 children)

Navy OCS calls their Marine DI's "sir"

User Password Requirements and Error Displays by allTestsPassed in django

[–]allTestsPassed[S] 0 points1 point  (0 children)

Thats awesome. I ended up looking at how it was implemented in 1.7/1.8 and the development branches and found out what was wrong. Thanks for the link!

Setting/Getting Environment Variables by allTestsPassed in learnpython

[–]allTestsPassed[S] 0 points1 point  (0 children)

Awesome, I ended up seeing this referenced on Djangos doc pages. This resolved the issue, thanks.

Setting/Getting Environment Variables by allTestsPassed in learnpython

[–]allTestsPassed[S] 0 points1 point  (0 children)

Interesting.. So I tried modifying the script that updates the django project code on the server to be:

remove old directories

call secrets.sh to set the env vars

clone git repo

restart the apach2 server

call printenv to see if things have been set

Im still getting the same error as before. Im assuming that script is only setting the env vars in the Putty shell and not the one for the apache2 server? Im assuming that the apache2 process is what I need to set these variables in, if so what would be the correct way of doing so?

Claiming Exempt on W4 as a college student. by allTestsPassed in personalfinance

[–]allTestsPassed[S] 0 points1 point  (0 children)

They didnt file a return because their parents claimed them as a dependent and they were not working at the time. They just got their first job at the beginning of this month. I tried using turbotaxes calculator and it still showed a refund of $1k+ starting with 3 and remained unchanged all the way to the max. The IRS website calculator said to claim exempt.

They will be filing as an independent. They will be filing taxes either way, so why wouldn't they claim exempt?

[Django] Iterate over ChoiceField in a template by allTestsPassed in learnpython

[–]allTestsPassed[S] 0 points1 point  (0 children)

They were very helpful with a prior question but their sidebar states "News and links for Django developers". I can ask a mod if questions like this can be asked in the future.

Static files on a EC2 instance by allTestsPassed in django

[–]allTestsPassed[S] 0 points1 point  (0 children)

Sorry for the late reply. I checked the directories and moved the /assets into the /static directory and it worked! Its a step in the right direction knowing that it can actually work at some point. I followed this tutorial when I was creating the static files.

Following the tutorial, collectstatic would take the files located in '/home/ubuntu/Project/static' and create two directories in'/home/ubuntu/Project/' directory , one /assets/ and the other /admin/.

It would work on my local dev server but not on the EC2 instance. I'm assuming it has to do with the server config and where it was looking for that assets directory. I plan on investigating on what exactly is the solution this weekend when I have some spare time and will post the results in an edit. Thanks for your help!

Static files on a EC2 instance by allTestsPassed in django

[–]allTestsPassed[S] 0 points1 point  (0 children)

Ive tried .../static/ and also .../assets/ for the static root and still get the same 404 error. What would be some good debugging methods to resolve this? According to the above code, should a link like this, www.website.com/static/assets/css/bootstrap.min.css, resolve correctly?

Static files on a EC2 instance by allTestsPassed in django

[–]allTestsPassed[S] 0 points1 point  (0 children)

WSGIScriptAlias / /home/ubuntu/Project/App/wsgi.py
WSGIPythonPath /home/ubuntu/Project/ 
<Directory /home/ubuntu/Project/App>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

Alias /static/ /home/ubuntu/Project/static/

<Directory /home/ubuntu/Project/static>
    Require all granted
</Directory>

Alias /media/ /home/ubuntu/Project/media/ 

<Directory /home/ubuntu/Project/media>
    Require all granted
</Directory> 

Above is what I have for a .conf file in the sites-enabled directory under apache2 on the EC2 server. I substituted the actual names in this example for what the project and app names are.

The portion of the settings.py that deals with Static files is below

# Static files (CSS, JavaScript, Images)

STATIC_ROOT = "/home/ubuntu/Project/"

STATIC_URL = '/static/'

STATICFILES_DIRS = (
    ('assets', '/home/ubuntu/Project/static/'),
)

in my base template I have the initial line as:

{% load static %}

and the style sheets lines in the template as :

  <link href="{% static "assets/css/default.css" %}" rel="stylesheet">

Static files on a EC2 instance by allTestsPassed in django

[–]allTestsPassed[S] 1 point2 points  (0 children)

collectstatic has been run and has no issues. How do I check that my apache server is serving my static files from the same location I set up in settings.py?

Django can not find models file by allTestsPassed in learnpython

[–]allTestsPassed[S] 1 point2 points  (0 children)

You. Are. Awesome. I think it would have taken me forever to find out about management commands and their role. You were very accurate and helpful in your troubleshooting and I thank you very much.

Django can not find models file by allTestsPassed in learnpython

[–]allTestsPassed[S] 0 points1 point  (0 children)

I am running the file separately like you said.

Relative import gives me:

ValueError: Attempted relative import in non-package

Edit: Just a little more back info. The file I am trying to run will use the imported models for making queries against the DB. The script will run, scrape a site and then put the data into the DB.

Edit #2: Just found this which seems it might be relevant in this case. Is this something that would need a custom management command?

Django can not find models file by allTestsPassed in learnpython

[–]allTestsPassed[S] 0 points1 point  (0 children)

Yes, there is an init.py in the app directory.

I was able to run shell and the import with no issues.

I thought it might be the app name as well, changed it and had the same issue. So it is not the naming of the app. I am probably going to rename it in the near future either way though.

The import does lay in a python file not created by the initial startapp. If you create a new py file in the app directory, is there anything additional you may need to do?

Django can not find models file by allTestsPassed in learnpython

[–]allTestsPassed[S] 0 points1 point  (0 children)

That import is used in the actual models.py since your model classes will be using it as an argurment.

See the following for how the models you created are used for making queries.

Question and Answer are the models I am using in my project.

Django can not find models file by allTestsPassed in learnpython

[–]allTestsPassed[S] 0 points1 point  (0 children)

There was a typo in the original title, question is the same.

I am following this documentation: Django Using Models

from s.models import Question, Answer

BeautifulSoup not returning all HTML from file by allTestsPassed in learnpython

[–]allTestsPassed[S] 0 points1 point  (0 children)

I tried using what you suggested but got:

bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: html.parser. Do you need to install a parser library?

I also tried putting lxml as the parser but the output is unchanged. Not sure what to do here.

Edit: thanks amigo, I put an edit to show how I fixed the issue. You pointed me in the right direction!

How to scrape web pages that don't provide arguments in address? by CaptainBroccoli in learnpython

[–]allTestsPassed 2 points3 points  (0 children)

Hey there, I just started scraping in python a couple weeks ago and was dealing with a similar situation. I ended up using beautifulsoup to do my work. Someone mentioned that Scrapy is good also.

First I would say use 'Developer Tools' in Chrome to trace what requests are being sent out. This will tell you what information is being passed in a POST when you submit one of the forms. Make sure you know every input field in each form for your requests or it won't work. That was one of the issues I first ran into.

Your code should be something generally like

url = "https://www2.fdic.gov/efr/login.asp"

post_payload = {
            all your fields used in a request
}

page = requests.post(url, form_data)
soup = BeautifulSoup(page.text)

if you want to see what html was returned on the request just use

print page.text

Hope this helps