Re: [Arches] Disallowed host

2017-11-22 Thread Cyrus Hiatt
That's great to know. Thanks Vincent!

- Cyrus

On Wed, Nov 22, 2017 at 9:19 AM, Vincent Meijer 
wrote:

> For future reference (but not yet directly relevant for Andy's use case):
>
> If you run AWS EC2 instances behind an Elastic Load Balancer, you also
> need to add the EC2 instance's private IP (and potentially its public
> hostname) to the ALLOWED_HOSTS setting.
> This is because the load balancer uses the private IP to address your EC2
> instances for health checks, instead of the hostname you chose.
>
> Here is how to do that. Simply add this to your settings.py:
>
> # Fix for AWS ELB returning false bad health: ELB contacts EC2 instances
> through their private ip.
> # An AWS service is called to get this private IP of the current EC2 node.
> Then the IP is added to ALLOWS_HOSTS so that Django answers to it.
> EC2_PRIVATE_IP = None
> try:
> EC2_PRIVATE_IP = requests.get('http://169.254.169.254/latest/meta-data/
> local-ipv4', timeout=0.01).text
> except requests.exceptions.RequestException:
> pass
> if EC2_PRIVATE_IP:
> ALLOWED_HOSTS.append(EC2_PRIVATE_IP)
> EC2_PUBLIC_HOSTNAME = None
> try:
> EC2_PUBLIC_HOSTNAME = requests.get('http://169.254.
> 169.254/latest/meta-data/public-hostname', timeout=0.01).text
> except requests.exceptions.RequestException:
> pass
> if EC2_PUBLIC_HOSTNAME:
> ALLOWED_HOSTS.append(EC2_PUBLIC_HOSTNAME)
>
>
>
> On Wednesday, 8 November 2017 12:42:58 UTC-5, Adam Cox wrote:
>>
>> Hey Andy, that's great, glad to hear it's working well. Good note about
>> the Projects folder too. It is a small detail, but could trip someone up
>> for a minute if they are looking for an exact replica of the installation
>> instructions.
>>
>> Adam
>>
>> On Wed, Nov 8, 2017 at 10:53 AM, Andy Graham  wrote:
>>
>>> Thanks much Adam, very helpful.
>>>
>>> The AMI worked great and didn't have any issues once I updated.  Only
>>> thing I would point out is that the AMI doesn't nest the arches and ENV
>>> folder in a Projects folder as recommended in the installation
>>> instructions.  Not that big of a deal, just thought I would point it out.
>>> Once again, thanks for the help.
>>>
>>> Andy
>>>
>>> On Tuesday, November 7, 2017 at 4:26:38 PM UTC-8, Adam Cox wrote:

 Hey Andy, great question. ALLOWED_HOSTS is actually a variable that you
 can define in your settings.py or settings_local.py file. It should be a
 list, so something like

 ALLOWED_HOSTS = ["12.34.56.78","arches4.andygraham.com"]

 would be a valid entry. You can also use ["*"] to allow all hosts. Not
 recommended for production of course, but could get past a the problem in a
 pinch if you ip or domain is changing a lot...

 I am glad to hear you were able to use that AMI. I made it a while ago,
 so it could probably stand some updates. Let me know if you find any
 problems with dependencies and such.

 Adam

 On Nov 7, 2017 4:53 PM, "Andy Graham"  wrote:

> Attempted to install Arch V4 to test out some of the features.  Set up
> an instance on AWS, downloaded the Arches 4 community instance that I 
> think
> Adam put up there a while ago.  Once that was set up I went through and 
> and
> followed the Developer Installation instruction to make sure everything 
> was
> up to date and set up correctly.  I then ran the runsever command, went to
> the website (public IP:8000) and got an error page that said
> "DisallowedHost at /Invalid HTTP_HOST header: 'xx.xx.xx.xx.:8000'. You
> may need to add u'xx.xx.xx.xx' to ALLOWED_HOSTS.", with the xx as my 
> public
> IP.  Based on additional information I went to the request.py file in
> ENV/lib/python2.7/site-packages/django/http and edited the
> "allowed_hosts" on line 102 to include my IP.  Everything worked fine 
> after
> that but I am guessing that this isn't standard protocol.  Any suggestions
> on what I did wrong and how to fix it so I don't have to add that info 
> when
> spin up another instance?  Thanks.
>
> Andy
>
> --
> -- To post, send email to arches...@googlegroups.com. To unsubscribe,
> send email to archesprojec...@googlegroups.com. For more information,
> visit https://groups.google.com/d/forum/archesproject?hl=en
> ---
> You received this message because you are subscribed to the Google
> Groups "Arches Project" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to archesprojec...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
 --
>>> -- To post, send email to arches...@googlegroups.com. To unsubscribe,
>>> send email to archesprojec...@googlegroups.com. For more information,
>>> visit https://groups.google.com/d/forum/archesproject?hl=en
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Arches Project" group.
>>> To unsubscribe from this group and

Re: [Arches] Disallowed host

2017-11-22 Thread Vincent Meijer
For future reference (but not yet directly relevant for Andy's use case):

If you run AWS EC2 instances behind an Elastic Load Balancer, you also need 
to add the EC2 instance's private IP (and potentially its public hostname) 
to the ALLOWED_HOSTS setting.
This is because the load balancer uses the private IP to address your EC2 
instances for health checks, instead of the hostname you chose.

Here is how to do that. Simply add this to your settings.py:

# Fix for AWS ELB returning false bad health: ELB contacts EC2 instances 
through their private ip.
# An AWS service is called to get this private IP of the current EC2 node. 
Then the IP is added to ALLOWS_HOSTS so that Django answers to it.
EC2_PRIVATE_IP = None
try:
EC2_PRIVATE_IP = requests.get(
'http://169.254.169.254/latest/meta-data/local-ipv4', timeout=0.01).text
except requests.exceptions.RequestException:
pass
if EC2_PRIVATE_IP:
ALLOWED_HOSTS.append(EC2_PRIVATE_IP)
EC2_PUBLIC_HOSTNAME = None
try:
EC2_PUBLIC_HOSTNAME = requests.get(
'http://169.254.169.254/latest/meta-data/public-hostname', timeout=0.01
).text
except requests.exceptions.RequestException:
pass
if EC2_PUBLIC_HOSTNAME:
ALLOWED_HOSTS.append(EC2_PUBLIC_HOSTNAME)



On Wednesday, 8 November 2017 12:42:58 UTC-5, Adam Cox wrote:
>
> Hey Andy, that's great, glad to hear it's working well. Good note about 
> the Projects folder too. It is a small detail, but could trip someone up 
> for a minute if they are looking for an exact replica of the installation 
> instructions.
>
> Adam
>
> On Wed, Nov 8, 2017 at 10:53 AM, Andy Graham  > wrote:
>
>> Thanks much Adam, very helpful.
>>
>> The AMI worked great and didn't have any issues once I updated.  Only 
>> thing I would point out is that the AMI doesn't nest the arches and ENV 
>> folder in a Projects folder as recommended in the installation 
>> instructions.  Not that big of a deal, just thought I would point it out.  
>> Once again, thanks for the help.
>>
>> Andy 
>>
>> On Tuesday, November 7, 2017 at 4:26:38 PM UTC-8, Adam Cox wrote:
>>>
>>> Hey Andy, great question. ALLOWED_HOSTS is actually a variable that you 
>>> can define in your settings.py or settings_local.py file. It should be a 
>>> list, so something like
>>>
>>> ALLOWED_HOSTS = ["12.34.56.78","arches4.andygraham.com"]
>>>
>>> would be a valid entry. You can also use ["*"] to allow all hosts. Not 
>>> recommended for production of course, but could get past a the problem in a 
>>> pinch if you ip or domain is changing a lot...
>>>
>>> I am glad to hear you were able to use that AMI. I made it a while ago, 
>>> so it could probably stand some updates. Let me know if you find any 
>>> problems with dependencies and such.
>>>
>>> Adam
>>>
>>> On Nov 7, 2017 4:53 PM, "Andy Graham"  wrote:
>>>
 Attempted to install Arch V4 to test out some of the features.  Set up 
 an instance on AWS, downloaded the Arches 4 community instance that I 
 think 
 Adam put up there a while ago.  Once that was set up I went through and 
 and 
 followed the Developer Installation instruction to make sure everything 
 was 
 up to date and set up correctly.  I then ran the runsever command, went to 
 the website (public IP:8000) and got an error page that said 
 "DisallowedHost at /Invalid HTTP_HOST header: 'xx.xx.xx.xx.:8000'. You 
 may need to add u'xx.xx.xx.xx' to ALLOWED_HOSTS.", with the xx as my 
 public 
 IP.  Based on additional information I went to the request.py file in 
 ENV/lib/python2.7/site-packages/django/http and edited the "allowed_hosts" 
 on line 102 to include my IP.  Everything worked fine after that but I am 
 guessing that this isn't standard protocol.  Any suggestions on what I did 
 wrong and how to fix it so I don't have to add that info when spin up 
 another instance?  Thanks.

 Andy

 -- 
 -- To post, send email to arches...@googlegroups.com. To unsubscribe, 
 send email to archesprojec...@googlegroups.com. For more information, 
 visit https://groups.google.com/d/forum/archesproject?hl=en
 --- 
 You received this message because you are subscribed to the Google 
 Groups "Arches Project" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to archesprojec...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>> -- 
>> -- To post, send email to arches...@googlegroups.com . To 
>> unsubscribe, send email to archesprojec...@googlegroups.com . 
>> For more information, visit 
>> https://groups.google.com/d/forum/archesproject?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Arches Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to archesprojec...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
-- To post, send email to archesproject@googl

Re: [Arches] Django not installed message

2017-11-22 Thread Roshan Bhurtha
Dear Adam, 
Thanks for your reply. 
I ran  the "pip install arches --no-binary :all:"   command, and it said 
all "Requirement already satisfied", BUT django was not installed when I 
imported inside Python!
Have a look at this screenshot please.
Any ideas what I am doing wrong ?
Thanks 
Roshan




On Friday, 17 November 2017 18:40:22 UTC+2, Adam Cox wrote:
>
> Hi Roshan,
>
> Any command you run that references the manage.py file must be run with 
> the virtual environment activated, which will add the (ENV) prefix to your 
> command prompt.
>
> To quickly test that Django (along with all other python dependencies) has 
> installed correctly, you can activate your virtual environment, then run 
> python (which will open the python interpreter) then import django. If 
> you get an error, then something didn't work during the pip install 
> arches --no-binary :all: process. To exit the python interpreter, use 
> exit().
>
> FYI, I have just finished an overhaul of the installation documentation 
> that should clear up some issues that have come up, streamline the process, 
> as well as a command to load an example package that we have made so it is 
> easier to get up and running. You can find it here: 
> http://arches4.readthedocs.io/en/latest/installation/ (as before).
>
> Adam
>
> On Fri, Nov 17, 2017 at 7:05 AM, Roshan Bhurtha  > wrote:
>
>> Dear all
>> I am trying to install arches( Windows 64-bit) and I am now at  the stage 
>> where I have to create a project, with the command *"python 
>> C:\Projects\ENV\Scripts\arches-project create my_project"*
>> * , *as given on the arches website.
>>
>> I run into a problem here: I am assuming that I have to run the above 
>> mentioned command OUT of the (*ENV) * that I created ?
>>
>> And if I do run this command from a normal windows command line (out of 
>> the ENV) , i get the  error message  "ImportError: no module named django" 
>> How do I proceed ? And at what stage was Django supposed to have been 
>> installed in the process ?
>> I am trying to do as diligently as possible and follow the steps given 
>> exactly, but obviously I made am error(s) somewhere. Any help will be much 
>> appreciated.
>>
>> thanks !
>> Roshan
>>
>> -- 
>> -- To post, send email to arches...@googlegroups.com . To 
>> unsubscribe, send email to archesprojec...@googlegroups.com . 
>> For more information, visit 
>> https://groups.google.com/d/forum/archesproject?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Arches Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to archesprojec...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
-- To post, send email to archesproject@googlegroups.com. To unsubscribe, send 
email to archesproject+unsubscr...@googlegroups.com. For more information, 
visit https://groups.google.com/d/forum/archesproject?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Arches Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to archesproject+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.